Commit Graph

24796 Commits

Author SHA1 Message Date
Michael Zolotukhin d0cf6c852a Imply linker arguments from '-fveclib' option.
Summary: As discussed in D8097, we should provide corresponding linking flags when 'fveclib' is specified.

Reviewers: hfinkel

Differential Revision: http://reviews.llvm.org/D8362

llvm-svn: 232556
2015-03-17 22:13:05 +00:00
Reid Kleckner 93f661a1da MS ABI: Build C++ default argument exprs for exported template classes
This was an omission from r232229.

llvm-svn: 232554
2015-03-17 21:51:43 +00:00
David Majnemer 5f0dd6162c MS ABI: Emit HandlerMap entries for C++ catch
The HandlerMap describes, to the runtime, what sort of catches surround
the try.  In principle, this structure has to be emitted by the backend
because only it knows the layout of the stack (the runtime needs to know
where on the stack the destination of a copy lives, etc.) but there is
some C++ specific information that the backend can't reason about.

Stick this information in special LLVM globals with the relevant
"const", "volatile", "reference" info mangled into the name.

llvm-svn: 232538
2015-03-17 20:35:05 +00:00
Michael Zolotukhin c888dd0cb8 Add fveclib option.
Review: http://reviews.llvm.org/D8097
llvm-svn: 232533
2015-03-17 20:03:11 +00:00
Reid Kleckner bba3cb95cc MS ABI: Delay default constructor closure checking until the outermost class scope ends
Previously, we would error out on this code because the default argument
wasn't parsed until the end of Outer:

  struct __declspec(dllexport) Outer {
    struct __declspec(dllexport) Inner {
      Inner(void *p = 0);
    };
  };

Now we do the checking on the closing brace of Outer instead of Inner.

llvm-svn: 232519
2015-03-17 19:00:50 +00:00
Dmitri Gribenko 7fe22f66d0 Comment parsing: move a diagnostic to the correct group.
Based on a patch by LE GARREC Vincent.

llvm-svn: 232511
2015-03-17 18:03:42 +00:00
Hans Wennborg f9d865b059 Revert r232454 and r232456: "Fix the LLVM type used when lowering initializer list reference temporaries to global variables."
This caused PR22940.

llvm-svn: 232496
2015-03-17 16:38:58 +00:00
Renato Golin e11531f7ea [ARM] Add support for ARMV6K subtarget (Clang)
ARMv6K is another layer between ARMV6 and ARMV6T2. This is the Clang
side of the changes.

ARMV6 family LLVM implementation.

+-------------------------------------+
| ARMV6                               |
+----------------+--------------------+
| ARMV6M (thumb) | ARMV6K (arm,thumb) | <- From ARMV6K and ARMV6M processors
+----------------+--------------------+    have support for hint instructions
| ARMV6T2 (arm,thumb,thumb2)          |    (SEV/WFE/WFI/NOP/YIELD). They can
+-------------------------------------+    be either real or default to NOP.
| ARMV7 (arm,thumb,thumb2)            |    The two processors also use
+-------------------------------------+    different encoding for them.

Patch by Vinicius Tinti.

llvm-svn: 232469
2015-03-17 11:55:43 +00:00
Nick Lewycky 563dfdb111 Fix test in release mode.
llvm-svn: 232456
2015-03-17 02:31:46 +00:00
Richard Smith 15e32fd215 [modules] Fix bug where an anonymous namespace could cause the containing
namespace to not merge properly.

We have an invariant here: after a declaration reads its canonical declaration,
it can assume the canonical declaration is fully merged. This invariant can be
violated if deserializing some declaration triggers the deserialization of a
later declaration, because that later declaration can in turn deserialize a
redeclaration of that first declaration before it is fully merged.

The anonymous namespace for a namespace gets stored with the first declaration
of that namespace, which may be before its parent namespace, so defer loading
it until after we've finished merging the surrounding namespace.

llvm-svn: 232455
2015-03-17 02:23:11 +00:00
Nick Lewycky cf191adaf5 Fix the LLVM type used when lowering initializer list reference temporaries to global variables.
llvm-svn: 232454
2015-03-17 02:21:31 +00:00
Duncan P. N. Exon Smith a7fd07f3fc CodeGenCXX: Test that linetables work with variadic virtual thunks
Add a frontend test for PR22929, which was fixed by LLVM r232449.
Besides the crash test, check that the `!dbg` attachment is sane since
its presence was the trigger.

llvm-svn: 232450
2015-03-17 01:19:01 +00:00
Richard Trieu a1877598aa Take the non-reference type when constructing a dummy expression.
Otherwise, Expr will assert during construction with a reference type.

llvm-svn: 232425
2015-03-16 21:49:43 +00:00
Richard Smith e687bf83c0 [modules] If we find more formerly-canonical declarations of an entity while
building its redecl chains, make sure we pull in the redeclarations of those
canonical declarations.

It's pretty difficult to reach a situation where we can find more canonical
declarations of an entity while building its redecl chains; I think the
provided testcase (4 modules and 7 declarations) cannot be reduced further.

llvm-svn: 232411
2015-03-16 20:54:07 +00:00
Joerg Sonnenberger 1d3b431c98 Global inline assembler blocks are merged before parsing, so no specific
location data is available. If pragma handling wants to look up the
position, it finds the LLVM buffer and wants to compare it with the
special built-in buffer, failing badly. Extend to the special handling
of the built-in buffer to also check for the inline asm buffer. Expect
only a single asm buffer. Sort it between the built-in buffers and the
normal file buffers.

Fixes the assert part of PR 22576.

llvm-svn: 232389
2015-03-16 17:54:54 +00:00
Alexander Musman 7931b98735 [OPENMP] Enable codegen of the ‘private’ clause for ‘omp simd’ directive
llvm-svn: 232353
2015-03-16 07:14:41 +00:00
David Majnemer ad803d4b76 MS ABI: Don't use qualified pointee types for 'catch' EH TypeDescriptors
Qualifiers are located next to the TypeDescriptor in order to properly
ensure that a pointer type can only be caught by a more qualified catch
handler.  This means that a catch handler of type 'const int *' requires
an RTTI object for 'int *'.  We got this correct for 'throw' but not for
'catch'.

N.B.  We don't currently have the means to store the qualifiers because
LLVM's EH strategy is tailored to the Itanium scheme.  The Itanium ABI
stores qualifiers inside the type descriptor in such a way that the
manner of qualification is stored in addition to the pointee type's
descriptor.  Perhaps the best way of modeling this for the MS ABI is
using an aggregate type to bundle the qualifiers with the descriptor?
This is tricky because we want to make it clear to the optimization
passes which catch handlers invalidate other handlers.

My current thoughts on a design for this is along the lines of:
  { { TypeDescriptor* TD, i32 QualifierFlags }, i32 MiscFlags }

The idea is that the inner most aggregate is all that is needed to
communicate that one catch handler might supercede another.  The
'MiscFlags' field would be used to hold the bitpattern for the notion
that the 'catch' handler does not need to invoke a copy-constructor
because we are catching by reference.

llvm-svn: 232318
2015-03-15 07:10:01 +00:00
Dmitri Gribenko ad80af8f19 -Wempty-body: fix false negative triggered by macros
When if statement condition ended in a macro:

    if (ptr == NULL);

the check used to consider the definition location of NULL, instead of the
current line.

Patch by Manasij Mukherjee.

llvm-svn: 232295
2015-03-15 01:08:23 +00:00
David Majnemer 8062eb6bed CodeGen: Correctly initialize bitfields with non-constant initializers
It is possible to construct an initializer for a bitfield which is not
constant.  Instead of emitting code to initialize the field before the
execution of main, clang would crash.

llvm-svn: 232285
2015-03-14 22:24:38 +00:00
David Majnemer bc02d32f4d MS ABI: Mangle virtual member pointer thunks with the correct CC
Virtual member pointers are implemented using a thunk.  We assumed that
the calling convention for this thunk was always __thiscall for 32-bit
targets and __cdecl for 64-bit targets.  However, this is not the case.
Mangle in whichever calling convention is appropriate for this member
function thunk.

llvm-svn: 232254
2015-03-14 06:34:41 +00:00
Chandler Carruth 0d745bcf66 [modules] Teach the AST reader to handle the case of importing a module
with a subset of the existing target CPU features or mismatched CPU
names.

While we can't check that the CPU name used to build the module will end
up being able to codegen correctly for the translation unit, we actually
check that the imported features are a subset of the existing features.

While here, rewrite the code to use std::set_difference and have it
diagnose all of the differences found.

Test case added which walks the set relationships and ensures we
diagnose all the right cases and accept the others.

No functional change for implicit modules here, just better diagnostics.

llvm-svn: 232248
2015-03-14 04:47:43 +00:00
Peter Collingbourne d2926c91d5 Implement bad cast checks using control flow integrity information.
This scheme checks that pointer and lvalue casts are made to an object of
the correct dynamic type; that is, the dynamic type of the object must be
a derived class of the pointee type of the cast. The checks are currently
only introduced where the class being casted to is a polymorphic class.

Differential Revision: http://reviews.llvm.org/D8312

llvm-svn: 232241
2015-03-14 02:42:25 +00:00
Ahmed Bougacha 5a4aa42a59 Add a bunch of missing "CHECK" colons in tests. NFC.
llvm-svn: 232237
2015-03-14 01:10:19 +00:00
David Majnemer 37fd66e78b MS ABI: Generate default constructor closures
The MS ABI utilizes a compiler generated function called the "vector
constructor iterator" to construct arrays of objects with
non-trivial constructors/destructors.  For this to work, the constructor
must follow a specific calling convention.  A thunk must be created if
the default constructor has default arguments, is variadic or is
otherwise incompatible.  This thunk is called the default constructor
closure.

N.B.  Default constructor closures are only generated if the default
constructor is exported because clang itself does not utilize vector
constructor iterators.  Failing to export the default constructor
closure will result in link/load failure if a translation unit compiled
with MSVC is on the import side.

Differential Revision: http://reviews.llvm.org/D8331

llvm-svn: 232229
2015-03-13 22:36:55 +00:00
Robert Lougher 7607b918a7 Make tests more robust. No functional change.
In preparation for recommit of revision 232190, change tests so that they
are resilient to operands being commuted by the reassociate pass.

llvm-svn: 232206
2015-03-13 20:35:45 +00:00
David Majnemer ba3e5ecf07 MS ABI: Implement __GetExceptionInfo for std::make_exception_ptr
std::make_exception_ptr calls std::__GetExceptionInfo in order to figure
out how to properly copy the exception object.

Differential Revision: http://reviews.llvm.org/D8280

llvm-svn: 232188
2015-03-13 18:26:17 +00:00
David Blaikie bdf40a62a7 Test case updates for explicit type parameter to the gep operator
llvm-svn: 232187
2015-03-13 18:21:46 +00:00
David Blaikie 81e96f8192 Update test case to make it easier to automatically port to typeless pointer gep operator changes coming soon
llvm-svn: 232185
2015-03-13 18:21:11 +00:00
Daniel Jasper 0ab544f1a5 When building a module, all headers of submodules can be used.
This extends r232159.

llvm-svn: 232168
2015-03-13 14:29:39 +00:00
Alexey Bataev 1d160b1945 [OPENMP] Additional sema analysis for 'omp atomic[ update]'.
Adds additional semantic analysis + generation of helper expressions for proper codegen.

llvm-svn: 232164
2015-03-13 12:27:31 +00:00
Daniel Jasper b6ba46ef30 Make a module "use" also count as use of all its submodules
llvm-svn: 232159
2015-03-13 11:26:16 +00:00
Chandler Carruth c2132d8f33 [Modules] Teach Clang to survive ambiguous macros which come from system
headers even if they arrived when merging non-system modules.

The idea of this code is that we don't want to warn the user about
macros defined multiple times by their system headers with slightly
different definitions. We should have this behavior if either the
macro comes from a system module, or the definition within the module
comes from a system header. Previously, we would warn on ambiguous
macros being merged when they came from a users modules even though they
only showed up via system headers.

By surviving this we can handle common system header macro differences
like differing 'const' qualification of pointers due to some headers
predating 'const' being valid in C code, even when those systems headers
are pre-built into a system module.

Differential Revision: http://reviews.llvm.org/D8310

llvm-svn: 232149
2015-03-13 08:29:54 +00:00
Argyrios Kyrtzidis ee1d76f361 [libclang] Fix crash when code-completing inside constructor initializer for a builtin type.
rdar://20149746

llvm-svn: 232145
2015-03-13 07:39:30 +00:00
Argyrios Kyrtzidis 58d0e7ab79 [libclang] During member ref expression visitation, ignore base anonymous struct/union fields.
Otherwise they will shadow the real field that that we are interested in.

rdar://19783938

llvm-svn: 232141
2015-03-13 04:40:07 +00:00
Sanjay Patel 0a6da5de55 [X86, AVX2] Replace inserti128 and extracti128 intrinsics with generic shuffles
This is nearly identical to the v*f128_si256 parts of r231792 and r232052.

AVX2 introduced proper integer variants of the hacked integer insert/extract
C intrinsics that were created for this same functionality with AVX1.

This should complete the front end fixes for insert/extract128 intrinsics. 
Corresponding LLVM patch to follow.

llvm-svn: 232109
2015-03-12 21:54:24 +00:00
David Majnemer a1aea9aad4 MS ABI: Allow a nullptr_t exception to be caught by void * catch handler
A nullptr exception object can be caught by any pointer type catch
handler.  However, it is not possible to express this in the exception
info for the MS ABI.  As a middle ground, allow such exception objects
to be caught with pointer-to-void catch handlers.

llvm-svn: 232069
2015-03-12 17:44:49 +00:00
Sanjay Patel 0c351aba25 [X86, AVX] replace vextractf128 intrinsics with generic shuffles
This is very much like D8088 (checked in at r231792).

Now that we've replaced the vinsertf128 intrinsics,
do the same for their extract twins.

Differential Revision: http://reviews.llvm.org/D8275

llvm-svn: 232052
2015-03-12 15:50:36 +00:00
Benjamin Kramer 8610cae98a Sema: Don't emit a missing prototype warning for deleted functions.
This is a bit more involved than I anticipated, so here's a breakdown
of the changes:
  1. Call ActOnFinishFunctionBody _after_ we parsed =default and
     =delete specifiers. Saying that we finished the body before parsing
     =default is just wrong. Changing this allows us to use isDefaulted
     and isDeleted on a decl in ActOnFinishFunctionBody.
  2. Check for -Wmissing-prototypes after we parsed the function body.
  3. Disable -Wmissing-prototypes when the Decl isDeleted.

llvm-svn: 232040
2015-03-12 14:28:47 +00:00
Benjamin Kramer e4812148e1 Use Sema's PrintingPolicy when diagnosing DeclSpecs.
Sema overrides ASTContext's policy on the first emitted diagnostic
(doesn't matter if it's ignored or not). This means changing the order
of diagnostic emission in Sema suddenly changes the text of diagnostic
emitted from the parser.

In the test case -Wmissing-prototypes (ignored) was the culprit, use
'int main' to suppress that warning so we see when this regresses.
Also move it into Sema/ as it's not testing any C++.

llvm-svn: 232039
2015-03-12 14:28:38 +00:00
Alexander Musman 92bdaabf97 [OPENMP] CodeGen - 'omp for' with dynamic schedule kinds.
Differential Revision: http://reviews.llvm.org/D7138

llvm-svn: 232036
2015-03-12 13:37:50 +00:00
Alexey Bataev 2df54a07bf [OPENMP] Initial codegen for 'omp sections' and 'omp section' directives.
If only one section is found in the sections region, it is emitted just like single region.
Otherwise it is emitted as a static non-chunked loop.

#pragma omp sections
{
#pragma omp section
  {1}
  ...
  #pragma omp section
  {n}
}
is translated to something like

i32 <iter_var>
i32 <last_iter> = 0
i32 <lower_bound> = 0
i32 <upper_bound> = n-1
i32 <stride> = 1
call void @__kmpc_for_static_init_4(<loc>, i32 <gtid>, i32 34/*static non-chunked*/, i32* <last_iter>, i32* <lower_bound>, i32* <upper_bound>, i32* <stride>, i32 1/*increment always 1*/, i32 1/*chunk always 1*/)
<upper_bound> = min(<upper_bound>, n-1)
<iter_var> = <lb>
check:
br <iter_var> <= <upper_bound>, label cont, label exit
continue:
switch (IV) {
  case 0:
  {1};
  break;
  ...
  case <NumSection> - 1:
  {n};
  break;
  }
  ++<iter_var>
  br label check
  exit:
  call void @__kmpc_for_static_fini(<loc>, i32 <gtid>)
Differential Revision: http://reviews.llvm.org/D8244

llvm-svn: 232021
2015-03-12 08:53:29 +00:00
Justin Bogner 0cb14759fc Driver: Keep -isysroot flags in crash scripts if we're dumping a VFS
For crashes with a VFS (ie, with modules), the -isysroot flag is often
necessary to reproduce the crash. This is especially true if some
modules need to be rebuilt, since without the sysroot they'll try to
read headers that are outside of the VFS.

I find it likely that we should keep some of the other -i flags in
this case as well, but I haven't seen that come up in practice yet so
it seems better to be conservative.

llvm-svn: 231997
2015-03-12 00:52:56 +00:00
Justin Bogner 42220ed3da Driver: Print the clang version and original command in crash scripts
When a crash report script doesn't work for a reproduction on your
machine for one reason or another, it can be really tricky to figure
out why not. The compiler version that crashed and the original
command line before stripping flags are very helpful when this comes
up.

llvm-svn: 231989
2015-03-12 00:14:35 +00:00
Joerg Sonnenberger 27173288c2 Under duress, move check for target support of __builtin_setjmp/
__builtin_longjmp to Sema as requested by John McCall.

llvm-svn: 231986
2015-03-11 23:46:32 +00:00
Alexey Samsonov ce2e77c771 Add deprecation notice for -f(no-)sanitize-recover flags.
These flags should be replaced with corresponding
-f(no-)sanitize-recover=<list> flags.

llvm-svn: 231983
2015-03-11 23:34:25 +00:00
David Majnemer 678732933f Don't overconstrain a FileCheck pattern
llvm-svn: 231971
2015-03-11 21:50:09 +00:00
Hal Finkel 0d0a1a53e3 [PowerPC] ABI support for the QPX vector instruction set
Support for the QPX vector instruction set, used on the IBM BG/Q supercomputer,
has recently been added to the LLVM PowerPC backend. This vector instruction
set requires some ABI modifications because the ABI on the BG/Q expects
<4 x double> vectors to be provided with 32-byte stack alignment, and to be
handled as native vector types (similar to how Altivec vectors are handled on
mainline PPC systems). I've named this ABI variant elfv1-qpx, have made this
the default ABI when QPX is supported, and have updated the ABI handling code
to provide QPX vectors with the correct stack alignment and associated
register-assignment logic.

llvm-svn: 231960
2015-03-11 19:14:15 +00:00
David Majnemer dfa6d2067c MS ABI: Implement copy-ctor closures, finish implementing throw
This adds support for copy-constructor closures.  These are generated
when the C++ runtime has to call a copy-constructor with a particular
calling convention or with default arguments substituted in to the call.

Because the runtime has no mechanism to call the function with a
different calling convention or know-how to evaluate the default
arguments at run-time, we create a thunk which will do all the
appropriate work and package it in a way the runtime can use.

Differential Revision: http://reviews.llvm.org/D8225

llvm-svn: 231952
2015-03-11 18:36:39 +00:00
Richard Smith 7474dd92d3 [modules] When merging the pattern of a class template definition into a prior
definition, be sure to update the definition data on all declarations, not just
the canonical one, since the pattern might not be in the list of pending
definitions (if it used to be canonical itself).

One-line fix by me; reduced testcase by Daniel Jasper!

llvm-svn: 231950
2015-03-11 18:21:02 +00:00
Anastasia Stulova e8d88ac185 Reverted OpenCL2.0 atomic type commits r231932, r231935
(caused undesirable update of -std flag to use _Atomic)  

llvm-svn: 231942
2015-03-11 17:26:37 +00:00