Commit Graph

254742 Commits

Author SHA1 Message Date
Richard Smith 3291877656 [c++1z] Synthesize implicit deduction guides from constructors on demand. Rank
such guides below explicit ones, and ensure that references to the class's
template parameters are not treated as forwarding references.

We make a few tweaks to the wording in the current standard:
1) The constructor parameter list is copied faithfully to the deduction guide,
   without losing default arguments or a varargs ellipsis (which the standard
   wording loses by omission).
2) If the class template declares no constructors, we add a T() -> T<...> guide
   (which will only ever work if T has default arguments for all non-pack
   template parameters).
3) If the class template declares nothing that looks like a copy or move
   constructor, we add a T(T<...>) -> T<...> guide.
#2 and #3 follow from the "pretend we had a class type with these constructors"
philosophy for deduction guides.

llvm-svn: 295007
2017-02-14 00:25:28 +00:00
Nick Lewycky 0752762180 When the new expr's array size is an ICE, emit it as a constant expression.
This bypasses integer sanitization checks which are redundant on the expression since it's been checked by Sema. Fixes a clang codegen assertion on "void test() { new int[0+1]{0}; }" when building with -fsanitize=signed-integer-overflow.

llvm-svn: 295006
2017-02-13 23:49:55 +00:00
Michael Kuperstein 47a8b6829c Silence redundant semicolon warnings. NFC.
llvm-svn: 295005
2017-02-13 23:42:27 +00:00
Andrew Kaylor 709f1c2a9b [X86] Add MXCSR register
This adds MXCSR to the set of recognized registers for X86 targets and updates the instructions that read or write it. I do not intend for all of the various floating point instructions that implicitly use the control bits or update the status bits of this register to ever have that usage modeled by default. However, when constrained floating point modes (such as strict FP exception status modeling or dynamic rounding modes) are enabled, implicit use/def information for MXCSR will be added to those instructions.

Until those additional updates are made this should cause (almost?) no functional changes. Theoretically, this will prevent instructions like LDMXCSR and STMXCSR from being moved past one another, but that should be prevented anyway and I haven't found a case where it is happening now.

Differential Revision: https://reviews.llvm.org/D29903

llvm-svn: 295004
2017-02-13 23:38:52 +00:00
Alex Lorenz 46eed9d625 [CodeCompletion] Code complete the '__auto_type' keyword
rdar://29219185

llvm-svn: 295003
2017-02-13 23:35:59 +00:00
Kuba Mracek 53fc965b48 Fixup for r293885: Update external.cc testcase to include the forgotten stdlib.h.
llvm-svn: 295002
2017-02-13 23:28:06 +00:00
Alex Lorenz 8f4d399c99 [CodeCompletion] Code complete the missing C++11 keywords
This commit adds context sensitive code completion support for the C++11
keywords that currently don't have completion results.

The following keywords are supported by this patch:

alignas
constexpr
static_assert
noexcept (as a function/method qualifier)
thread_local

The following special identifiers are also supported:

final (as a method qualifier or class qualifier)
override

rdar://29219185

Differential Revision: https://reviews.llvm.org/D28286

llvm-svn: 295001
2017-02-13 23:19:40 +00:00
Sanjoy Das 5be2e8415c [LangRef] Explicitly allow readnone and reaodnly functions to unwind
Summary:
This change edits the language reference to explicitly allow the
existence of readnone and readonly functions that can throw.  Full
discussion at
http://lists.llvm.org/pipermail/llvm-dev/2017-January/108637.html

Reviewers: dberlin, chandlerc, hfinkel, majnemer

Reviewed By: majnemer

Subscribers: majnemer, mcrosier, llvm-commits

Differential Revision: https://reviews.llvm.org/D28740

llvm-svn: 295000
2017-02-13 23:19:07 +00:00
Sanjoy Das a3ff994268 [LangRef] Update the TBAA section
Summary:
Update the TBAA section to mention the struct path TBAA that LLVM
implements today.  This is not a proposal or change in semantics -- it
is intended only to **document** what LLVM already does today.

This is related to https://reviews.llvm.org/D26438 where I've tried to
implement some of the constraints as verifier checks.

Reviewers: anna, reames, rsmith, chandlerc, hfinkel, rjmccall, mehdi_amini, dexonsmith, manmanren

Reviewed By: manmanren

Subscribers: dberlin, dberris, mcrosier, llvm-commits

Differential Revision: https://reviews.llvm.org/D26831

llvm-svn: 294999
2017-02-13 23:14:03 +00:00
Sanjay Patel 4f74216da0 [FunctionAttrs] try to extend nonnull-ness of arguments from a callsite back to its parent function
As discussed here:
http://lists.llvm.org/pipermail/llvm-dev/2016-December/108182.html
...we should be able to propagate 'nonnull' info from a callsite back to its parent.

The original motivation for this patch is our botched optimization of "dyn_cast" (PR28430),
but this won't solve that problem.

The transform is currently disabled by default while we wait for clang to work-around
potential security problems:
http://lists.llvm.org/pipermail/cfe-dev/2017-January/052066.html

Differential Revision: https://reviews.llvm.org/D27855

llvm-svn: 294998
2017-02-13 23:10:51 +00:00
Charles Li e1958a083a [test] Make Lit tests C++11 Compatible - Objective-C++
Set 5 Objective-C++ tests to run at gnu++98

Differential Revision: https://reviews.llvm.org/D29739

llvm-svn: 294997
2017-02-13 23:09:56 +00:00
Amaury Sechet 3422b539c8 Revert autogenerated check result for test/CodeGen/X86/atomic-minmax-i6432.ll as they don't regenerate cleanly.
llvm-svn: 294996
2017-02-13 23:00:23 +00:00
Eric Fiselier d5abcd1b2e Add tests for noexcept functions
llvm-svn: 294995
2017-02-13 22:44:39 +00:00
Francis Ricci 7cda03e6d1 Use pthreads to manage thread-local storage on darwin for leak sanitizer
Summary:
__thread is supported on Darwin, but is implemented dynamically via
function calls to __tls_get_addr. This causes two issues when combined
with leak sanitizer, due to malloc() interception.

- The dynamic loader calls malloc during the process of loading
  the sanitizer dylib, while swapping a placeholder tlv_boostrap
  function for __tls_get_addr. This will cause tlv_bootstrap to
  be called in DisabledInThisThread() via the asan allocator.

- The first time __tls_get_addr is called, it allocates memory
  for the thread-local object, during which it calls malloc(). This
  call will be intercepted, leading to an infinite loop in the asan
  allocator, in which the allocator calls DisabledInThisThread,
  which calls tls_get_addr, which calls into the allocator again.

Reviewers: kcc, glider, kubamracek

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D29786

llvm-svn: 294994
2017-02-13 22:20:07 +00:00
Tim Northover 48dfa1a6ed GlobalISel: represent atomic loads & stores via the MachineMemOperand.
Also make sure the AArch64 backend doesn't try to convert them into normal
loads and stores.

llvm-svn: 294993
2017-02-13 22:14:16 +00:00
Tim Northover b73e309071 MIR: parse & print the atomic parts of a MachineMemOperand.
We're going to need them very soon for GlobalISel.

llvm-svn: 294992
2017-02-13 22:14:08 +00:00
Greg Clayton 6d325cb5cb Fix buildbots.
llvm-svn: 294991
2017-02-13 22:04:02 +00:00
Greg Clayton 5d0c114630 FindFunctions now works again with mangled names.
<rdar://problem/28147057> 

llvm-svn: 294990
2017-02-13 21:34:58 +00:00
Reid Kleckner b74485dfaa [CodeGen] Use bitfields instead of manual masks in ArgFlagsTy, NFC
This revealed that we actually have 8 more unused flag bits, and byval
size doesn't need to be a bitfield at all.

This came up during code review here:
https://reviews.llvm.org/D29668#inline-258469

llvm-svn: 294989
2017-02-13 21:33:26 +00:00
Rafael Espindola 195fba2967 Fix checks for R_386_8 and R_386_16.
Results created by these relocations are expected to be zero extended
at runtime.

llvm-svn: 294988
2017-02-13 21:29:56 +00:00
Chris Bieneman 752f73b680 [CMake] Adding API dependency on Utility
Utility is directly referenced from Breakpoint.

llvm-svn: 294987
2017-02-13 21:19:53 +00:00
Chris Bieneman aa2f4bf686 [CMake] Adding API dependency on Utility
Utility is directly referenced from API.

llvm-svn: 294986
2017-02-13 21:16:01 +00:00
Taewook Oh 4d35f9e10e Address post-commit comments for https://reviews.llvm.org/D29596. NFCI.
llvm-svn: 294985
2017-02-13 21:12:27 +00:00
Francis Ricci 259ad9cf08 Disable darwin interception of non-darwin functions
Summary: Fixes build issues when compiling lsan for darwin.

Reviewers: kubamracek, kcc, rnk

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D29785

llvm-svn: 294984
2017-02-13 21:06:13 +00:00
Francis Ricci 7406f0f54f Add lsan function stubs for darwin
Summary:
This patch provides stubs for all of the lsan platform-specific
functions which need to be implemented for darwin. Currently
all of these functions are stubs, for the purpose of fixing
compilation.

Reviewers: kcc, glider, kubamracek

Subscribers: mgorny, llvm-commits

Differential Revision: https://reviews.llvm.org/D29784

llvm-svn: 294983
2017-02-13 21:03:15 +00:00
Arnold Schwaighofer 8f3df731dc swiftcc: Don't emit tail calls from callers with swifterror parameters
Backends don't support this yet. They would have to move to the swifterror
register before the tail call to make sure it is live-in to the call.

rdar://30495920

llvm-svn: 294982
2017-02-13 19:58:28 +00:00
Peter Collingbourne 2b33f65317 IR: Type ID summary extensions for WPD; thread summary into WPD pass.
Make the whole thing testable by adding YAML I/O support for the WPD
summary information and adding some negative tests that exercise the
YAML support.

Differential Revision: https://reviews.llvm.org/D29782

llvm-svn: 294981
2017-02-13 19:26:18 +00:00
Alexey Bataev 7bed48e7a3 [SLP] Test for extractelement cost fix.
llvm-svn: 294980
2017-02-13 19:08:19 +00:00
Charles Li 2f84e43ce2 [Test] Make Lit tests C++11 compatible - printf format string
Different diagnostics when format string does not match 
actual arg type.

This commit contains the first 2 of 3 tests reviewed in D29685

llvm-svn: 294979
2017-02-13 18:57:06 +00:00
Reid Kleckner 9de921470d [CodeGen] Treat auto-generated __dso_handle symbol as HiddenVisibility
Fixes https://bugs.llvm.org/show_bug.cgi?id=31932

Based on a patch by Roland McGrath

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D29843

llvm-svn: 294978
2017-02-13 18:49:21 +00:00
Peter Collingbourne 904c5ed558 ELF: Read all dynamic lists specified on the command line.
We were previously only reading the last one.

Fixes PR31939 (which was likely the issue underlying
https://github.com/google/oss-fuzz/issues/295).

Differential Revision: https://reviews.llvm.org/D29861

llvm-svn: 294977
2017-02-13 18:31:12 +00:00
Taewook Oh 06a2128cfa Make MachineBasicBlock::updateTerminator to update DebugLoc as well
Summary:
Currently MachineBasicBlock::updateTerminator simply drops DebugLoc for newly created branch instructions, which may cause incorrect stepping and/or imprecise sample profile data. Below is an example:

```
  1 extern int bar(int x);
  2
  3 int foo(int *begin, int *end) {
  4   int *i;
  5   int ret = 0;
  6   for (
  7       i = begin ;
  8       i != end ;
  9       i++)
 10   {
 11       ret += bar(*i);
 12   }
 13   return ret;
 14 }
```

Below is a bitcode of 'foo' at the end of LLVM-IR level optimizations with -O3:

```
define i32 @foo(i32* readonly %begin, i32* readnone %end) !dbg !4 {
entry:
  %cmp6 = icmp eq i32* %begin, %end, !dbg !9
  br i1 %cmp6, label %for.end, label %for.body.preheader, !dbg !12

for.body.preheader:                               ; preds = %entry
  br label %for.body, !dbg !13

for.body:                                         ; preds = %for.body.preheader, %for.body
  %ret.08 = phi i32 [ %add, %for.body ], [ 0, %for.body.preheader ]
  %i.07 = phi i32* [ %incdec.ptr, %for.body ], [ %begin, %for.body.preheader ]
  %0 = load i32, i32* %i.07, align 4, !dbg !13, !tbaa !15
  %call = tail call i32 @bar(i32 %0), !dbg !19
  %add = add nsw i32 %call, %ret.08, !dbg !20
  %incdec.ptr = getelementptr inbounds i32, i32* %i.07, i64 1, !dbg !21
  %cmp = icmp eq i32* %incdec.ptr, %end, !dbg !9
  br i1 %cmp, label %for.end.loopexit, label %for.body, !dbg !12, !llvm.loop !22

for.end.loopexit:                                 ; preds = %for.body
  br label %for.end, !dbg !24

for.end:                                          ; preds = %for.end.loopexit, %entry
  %ret.0.lcssa = phi i32 [ 0, %entry ], [ %add, %for.end.loopexit ]
  ret i32 %ret.0.lcssa, !dbg !24
}
```

where

```
!12 = !DILocation(line: 6, column: 3, scope: !11)
```

. As you can see, the terminator of 'entry' block, which is a loop control branch, has a DebugLoc of line 6, column 3. Howerver, after the execution of 'MachineBlock::updateTerminator' function, which is triggered by MachineSinking pass, the DebugLoc info is dropped as below (see there's no debug-location for JNE_1):

```
  bb.0.entry:
    successors: %bb.4(0x30000000), %bb.1.for.body.preheader(0x50000000)
    liveins: %rdi, %rsi

    %6 = COPY %rsi
    %5 = COPY %rdi
    %8 = SUB64rr %5, %6, implicit-def %eflags, debug-location !9
    JNE_1 %bb.1.for.body.preheader, implicit %eflags
```

This patch addresses this issue and make newly created branch instructions to keep debug-location info.

Reviewers: aprantl, MatzeB, craig.topper, qcolombet

Reviewed By: qcolombet

Subscribers: qcolombet, llvm-commits

Differential Revision: https://reviews.llvm.org/D29596

llvm-svn: 294976
2017-02-13 18:15:31 +00:00
Benjamin Kramer 19f2403d3b [clang-tidy] Reduce indentation. NFC.
llvm-svn: 294974
2017-02-13 18:03:10 +00:00
Matthew Simpson 659f92e2aa Revert "[LV] Extend trunc optimization to all IVs with constant integer steps"
This reverts commit r294967. This patch caused execution time slowdowns in a
few LLVM test-suite tests, as reported by the clang-cmake-aarch64-quick bot.
I'm reverting to investigate.

llvm-svn: 294973
2017-02-13 18:02:35 +00:00
Charles Li 58a221a4e2 [Test] Make Lit tests C++11 compatible - nounwind noexcept
C++11 destructors are nothrow by default.

Differential Revision: https://reviews.llvm.org/D29859

llvm-svn: 294972
2017-02-13 17:56:30 +00:00
Davide Italiano db4b0a7194 [LTO] Add support for optimization remarks.
Differential Revision:  https://reviews.llvm.org/D29878

llvm-svn: 294971
2017-02-13 17:49:18 +00:00
Quentin Colombet fbae5fcb96 [FastISel] Add a diagnostic to warm on fallback.
This is consistent with what we do for GlobalISel. That way, it is easy
to see whether or not FastISel is able to fully select a function.
At some point we may want to switch that to an optimization remark.

llvm-svn: 294970
2017-02-13 17:38:59 +00:00
Eric Liu a13c419a29 [change-namespace] add an option to dump changed files in YAML.
Reviewers: hokein

Reviewed By: hokein

Subscribers: fhahn, cfe-commits

Differential Revision: https://reviews.llvm.org/D29893

llvm-svn: 294969
2017-02-13 17:24:14 +00:00
James Molloy 0ae2202235 [ARM] Fix crash caused by r294945
I'd missed a creator of FCMP nodes - duplicateCmp().

Kindly and promptly reported by Gabor Ballabas, due to his CSiBE test suite.

llvm-svn: 294968
2017-02-13 17:18:00 +00:00
Matthew Simpson 7b7f40297f [LV] Extend trunc optimization to all IVs with constant integer steps
This patch extends the optimization of truncations whose operand is an
induction variable with a constant integer step. Previously we were only
applying this optimization to the primary induction variable. However, the cost
model assumes the optimization is applied to the truncation of all integer
induction variables (even regardless of step type). The transformation is now
applied to the other induction variables, and I've updated the cost model to
ensure it is better in sync with the transformation we actually perform.

Differential Revision: https://reviews.llvm.org/D29847

llvm-svn: 294967
2017-02-13 16:48:00 +00:00
Simon Dardis d9858dfdee [mips] Fix failing test.
llvm-svn: 294966
2017-02-13 16:42:35 +00:00
Rafael Espindola d6e9ef7e21 Implement R_X86_64_16.
It is used by qemu.

llvm-svn: 294965
2017-02-13 16:21:34 +00:00
Sanjay Patel a62b8ce323 fix documentation comments; NFC
llvm-svn: 294964
2017-02-13 16:17:29 +00:00
Benjamin Kramer 8484a326fb [ASTUnit] Clear out diagnostic state after creating the preamble.
If the preamble had diagnostic state this would leave behind invalid
state in the DiagnosticsEngine and crash later. The test case runs into
an assertion in DiagnosticsEngine::setSourceManager.

llvm-svn: 294963
2017-02-13 16:16:43 +00:00
Davide Italiano cd6d7b1c5b [llvm-lto2] Fix typo spotted by Teresa (r294885 post-commit review).
llvm-svn: 294962
2017-02-13 16:08:36 +00:00
Davide Italiano 945de43dbe [PM] Add support for instrumented PGO in the new pass manager (clang-side)
Differential Revision:  https://reviews.llvm.org/D29309

llvm-svn: 294961
2017-02-13 16:07:05 +00:00
Simon Dardis 509da1a46d [mips] divide macro instruction cleanup.
Clean up the implementation of divide macro expansion by getting rid of a
FIXME regarding magic numbers and branch instructions. Match GAS' behaviour
for expansion of ddiv / div in the two and three operand cases. Add the two
operand alias for MIPSR6. Finally, optimize macro expansion cases where the
divisior is the $zero register.

Reviewers: slthakur

Differential Revision: https://reviews.llvm.org/D29887

llvm-svn: 294960
2017-02-13 16:06:48 +00:00
Simon Pilgrim fd6a84fbaa Fix indentation. NFCI.
llvm-svn: 294959
2017-02-13 15:31:08 +00:00
Saleem Abdulrasool 3444e9fa15 config: disable thread safety analysis on COFF
clang cannot properly handle __declspec and __attribute__ on classes
right now.  This prevents the shared_mutex tests from working.  Disable
the use of the annotation on COFF targets.

llvm-svn: 294958
2017-02-13 15:26:51 +00:00
Saleem Abdulrasool 8a5789ebd1 math: actually pull the declarations/overloads into std
The previous changes missed the change to include/cmath.  These changes
allow some of the rand.distribution tests to pass on Windows.

llvm-svn: 294957
2017-02-13 15:26:50 +00:00