Commit Graph

60141 Commits

Author SHA1 Message Date
Adrian Prantl ab010c4e0e Remove unneeded #include.
llvm-svn: 247081
2015-09-08 22:06:40 +00:00
John McCall 0a49015629 Collect SEH captures in a set instead of a vector to avoid
doing redundant work if a variable is used multiple times.

Fixes PR24751.

llvm-svn: 247075
2015-09-08 21:15:22 +00:00
Gabor Horvath 1cbf435cd6 [Static Analyzer] Objective-C Generics Checker improvements.
Differential Revision: http://reviews.llvm.org/D12701

llvm-svn: 247071
2015-09-08 21:04:14 +00:00
Adrian Prantl 748a6cd1ac Module Debugging: Emit debug type information into clang ObjC modules.
When -fmodule-format is set to "obj", emit debug info for all types
declared in a module or referenced by a declaration into the module's
object file container.

This patch adds support for Objective-C types and methods.

llvm-svn: 247068
2015-09-08 20:41:52 +00:00
Richard Smith 0516b1864d [modules] Write the options records to a separate subblock rather than writing
them directly to the control block. These are fairly large, and in a build with
lots of modules / chained PCH, we don't need to read most of them. No
functionality change intended.

llvm-svn: 247055
2015-09-08 19:40:14 +00:00
Douglas Katzman 38dca88838 [Shave]: add a -MT option to moviCompile if there wasn't one
Differential Revision: http://reviews.llvm.org/D12622

llvm-svn: 247052
2015-09-08 19:29:55 +00:00
Adrian Prantl 4aa2b3a311 Module Debugging: Emit debug type information into clang modules.
When -fmodule-format is set to "obj", emit debug info for all types
declared in a module or referenced by a declaration into the module's
object file container.

This patch adds support for C and C++ types.

llvm-svn: 247049
2015-09-08 19:20:27 +00:00
Naomi Musgrave 4e213984dd Failing test highlighting no poisoning if dtor undeclared.
Summary:
If class or struct has not declared a destructor,
no destructor is emitted, and members are not poisoned
after destruction. This case highlights bug in current
implementation of use-after-dtor poisoning (detailed
in https://github.com/google/sanitizers/issues/596).

Reviewers: eugenis, kcc

Subscribers: cfe-commits

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

Only check simplest object for existence of sanitizing callback.

Rename test.

llvm-svn: 247025
2015-09-08 16:38:17 +00:00
Manuel Klimek 3ecd8c0aab Fix performance regression when running clang tools.
Brings tool start time for a large synthetic test case down from (on my
machine) 4 seconds to 0.5 seconds.

llvm-svn: 247018
2015-09-08 15:14:06 +00:00
NAKAMURA Takumi 64319286d0 clang/test/CodeGen/complex-convert.c: Appease for targeting powerpc64-*.
llvm-svn: 247015
2015-09-08 14:19:13 +00:00
Jakub Kuderski f50ab0ffce findDominatingStoreToReturn in CGCall.cpp didn't check if a candidate store
instruction used the ReturnValue as pointer operand or value operand. This
led to wrong code gen - in later stages (load-store elision code) the found
store and its operand would be erased, causing ReturnValue to become a <badref>.

The patch adds a check that makes sure that ReturnValue is a pointer operand of
store instruction. Regression test is also added.

This fixes PR24386.
Differential Revision: http://reviews.llvm.org/D12400

llvm-svn: 247003
2015-09-08 10:36:42 +00:00
Manuel Klimek 7a2ba47fbf Update code owners for AST matchers / libtooling.
llvm-svn: 247001
2015-09-08 10:31:09 +00:00
Manuel Klimek e67a9d6d24 Fix documentation of numSelectorArgs.
Currently, the documentation for numSelectorArgs includes an incorrect
example. It shows a case where an argument of 1 will match a property
getter, but a getter will be matched only when N == 0.

This diff corrects the documentation and adds a test for numSelectorArgs(0).

Patch by Dave Lee.

llvm-svn: 246998
2015-09-08 10:11:26 +00:00
NAKAMURA Takumi ff7a9252e8 clangCodeGen: Fix comments. [-Wdocumentation]
llvm-svn: 246995
2015-09-08 09:42:41 +00:00
NAKAMURA Takumi f7bee71c26 Fix clang/test/CodeGen/mips-varargs.c for -Asserts, possibly typo.
llvm-svn: 246994
2015-09-08 09:37:09 +00:00
John McCall e78e08a92b Another fix to this test, this one apparently working by
coincidence on all bots.

llvm-svn: 246993
2015-09-08 09:33:33 +00:00
NAKAMURA Takumi c88d2fac7c Fix clang/test/CodeGenCXX/alignment.cpp for -Asserts.
llvm-svn: 246992
2015-09-08 09:31:04 +00:00
John McCall 999110f903 When building the alloca for a local variable, set its name
separately from building the instruction so that it's
preserved even in -Asserts builds.

Employ C++'s mystical "comment" feature to discourage
breaking this in the future.

llvm-svn: 246991
2015-09-08 09:18:30 +00:00
John McCall f1044c044a Remove unnecessary braces; this resolves against a
single-pointer overload instead of the ArrayRef one.

llvm-svn: 246988
2015-09-08 08:57:00 +00:00
John McCall bd96e98af7 Move BlockByrefHelpers back to CodeGenModule.h to placate MSVC.
llvm-svn: 246986
2015-09-08 08:21:11 +00:00
John McCall 7f416cc426 Compute and preserve alignment more faithfully in IR-generation.
Introduce an Address type to bundle a pointer value with an
alignment.  Introduce APIs on CGBuilderTy to work with Address
values.  Change core APIs on CGF/CGM to traffic in Address where
appropriate.  Require alignments to be non-zero.  Update a ton
of code to compute and propagate alignment information.

As part of this, I've promoted CGBuiltin's EmitPointerWithAlignment
helper function to CGF and made use of it in a number of places in
the expression emitter.

The end result is that we should now be significantly more correct
when performing operations on objects that are locally known to
be under-aligned.  Since alignment is not reliably tracked in the
type system, there are inherent limits to this, but at least we
are no longer confused by standard operations like derived-to-base
conversions and array-to-pointer decay.  I've also fixed a large
number of bugs where we were applying the complete-object alignment
to a pointer instead of the non-virtual alignment, although most of
these were hidden by the very conservative approach we took with
member alignment.

Also, because IRGen now reliably asserts on zero alignments, we
should no longer be subject to an absurd but frustrating recurring
bug where an incomplete type would report a zero alignment and then
we'd naively do a alignmentAtOffset on it and emit code using an
alignment equal to the largest power-of-two factor of the offset.

We should also now be emitting much more aggressive alignment
attributes in the presence of over-alignment.  In particular,
field access now uses alignmentAtOffset instead of min.

Several times in this patch, I had to change the existing
code-generation pattern in order to more effectively use
the Address APIs.  For the most part, this seems to be a strict
improvement, like doing pointer arithmetic with GEPs instead of
ptrtoint.  That said, I've tried very hard to not change semantics,
but it is likely that I've failed in a few places, for which I
apologize.

ABIArgInfo now always carries the assumed alignment of indirect and
indirect byval arguments.  In order to cut down on what was already
a dauntingly large patch, I changed the code to never set align
attributes in the IR on non-byval indirect arguments.  That is,
we still generate code which assumes that indirect arguments have
the given alignment, but we don't express this information to the
backend except where it's semantically required (i.e. on byvals).
This is likely a minor regression for those targets that did provide
this information, but it'll be trivial to add it back in a later
patch.

I partially punted on applying this work to CGBuiltin.  Please
do not add more uses of the CreateDefaultAligned{Load,Store}
APIs; they will be going away eventually.

llvm-svn: 246985
2015-09-08 08:05:57 +00:00
Ted Kremenek 3a0678e33c [analyzer] Apply whitespace cleanups by Honggyu Kim.
llvm-svn: 246978
2015-09-08 03:50:52 +00:00
Simon Pilgrim 437cc973fb [X86][SSE4A] Added SSE4A IR + assembly codegen builtin tests
llvm-svn: 246974
2015-09-07 20:10:11 +00:00
Simon Pilgrim 0d9d748bf1 [X86][SSSE3] Added SSSE3 IR + assembly codegen builtin tests
Transferred SSSE3 instructions from sse-builtins.c

llvm-svn: 246948
2015-09-06 17:06:22 +00:00
Simon Pilgrim ff88a0da31 [X86]][SSE3] Added SSE41 IR + assembly codegen builtin tests
Transferred SSE41 instructions from sse-builtins.c

llvm-svn: 246947
2015-09-06 16:38:17 +00:00
Alexandros Lamprineas 94d75dba14 Refactoring of how ARMTargetInfo handles default target features.
Differential Revision: http://reviews.llvm.org/D11299

llvm-svn: 246946
2015-09-06 16:15:45 +00:00
Simon Pilgrim 8391ac7001 [X86]][SSE3] Added SSE3 IR + assembly codegen builtin tests
llvm-svn: 246945
2015-09-06 14:45:13 +00:00
Simon Pilgrim de06f31885 [X86]][SSE42] Added SSE42 IR + assembly codegen builtin tests
llvm-svn: 246944
2015-09-06 14:05:33 +00:00
Saleem Abdulrasool 79c6971cdf Index: expose visibility attribute
Expose the previously unexposed visibility attribute via the python and C
bindings.

llvm-svn: 246931
2015-09-05 18:53:43 +00:00
George Burgess IV b40cd567c3 Fix a bug in __builtin_object_size cast removal
Apparently there are many cast kinds that may cause implicit pointer
arithmetic to happen. In light of this, the cast ignoring logic
introduced in r246877 has been changed to only ignore a small set of
cast kinds, and a test for this behavior has been added.

Thanks to Richard for catching this before it became a bug report. :)

llvm-svn: 246890
2015-09-04 22:36:18 +00:00
Reid Kleckner 3baf9c8ace Relax partial-init test case for ARM
llvm-svn: 246889
2015-09-04 22:32:51 +00:00
Hal Finkel 0e2b975eb6 Don't crash on a self-alias declaration
We were crashing in CodeGen given input like this:

  int self_alias(void) __attribute__((weak, alias("self_alias")));

such a self-alias is invalid, but instead of diagnosing the situation, we'd
proceed to produce IR for both the function declaration and the alias. Because
we already had a function named 'self_alias', the alias could not be named the
same thing, and so LLVM would pick a different name ('self_alias1' for example)
for that value. When we later called CodeGenModule::checkAliases, we'd look up
the IR value corresponding to the alias name, find the function declaration
instead, and then assert in a cast to llvm::GlobalAlias. The easiest way to prevent
this is simply to avoid creating the wrongly-named alias value in the first
place and issue the diagnostic there (instead of in checkAliases). We detect a
related cycle case in CodeGenModule::EmitAliasDefinition already, so this just
adds a second such check.

Even though the other test cases for this 'alias definition is part of a cycle'
diagnostic are in test/Sema/attr-alias-elf.c, I've added a separate regression
test for this case. This is because I can't add this check to
test/Sema/attr-alias-elf.c without disturbing the other test cases in that
file. In order to avoid construction of the bad IR values, this diagnostic
is emitted from within CodeGenModule::EmitAliasDefinition (and the relevant
declaration is not added to the Aliases vector). The other cycle checks are
done within the CodeGenModule::checkAliases function based on the Aliases
vector, called from CodeGenModule::Release.  However, if there have been errors
earlier, HandleTranslationUnit does not call Release, and so checkAliases is
never called, and so none of the other diagnostics would be produced.

Fixes PR23509.

llvm-svn: 246882
2015-09-04 21:49:21 +00:00
Richard Smith 81c7248cac Fix crash on invalid if we can't find a suitable PCH file in a specified
directory, and our frontend action cares whether the frontend setup actually
succeeded.

llvm-svn: 246881
2015-09-04 21:44:32 +00:00
Reid Kleckner 5ee4b9a11f Don't use unreachable as a placeholder, it confuses EmitBlock
This fixes an issue raised in D12412, where we generated invalid IR.

Thanks to Vedant Kumar for coming up with the initial work around.

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

llvm-svn: 246880
2015-09-04 21:39:15 +00:00
George Burgess IV 3a03fabdd0 Increase accuracy of __builtin_object_size.
Improvements:

- For all types, we would give up in a case such as:
    __builtin_object_size((char*)&foo, N);
  even if we could provide an answer to
    __builtin_object_size(&foo, N);
  We now provide the same answer for both of the above examples in all
  cases.

- For type=1|3, we now support subobjects with unknown bases, as long
  as the designator is valid.

Thanks to Richard Smith for the review + design planning.

Review: http://reviews.llvm.org/D12169
llvm-svn: 246877
2015-09-04 21:28:13 +00:00
Hans Wennborg 5427a69545 Don't allow dllexport/import on static local variables
They might technically have external linkage, but it still doesn't make sense
for the user to try and export such variables. This matches MSVC's and MinGW's
behaviour.

llvm-svn: 246864
2015-09-04 19:59:39 +00:00
Aaron Ballman c129c69105 Fixing a bug where hasType(decl()) would fail to match on C code involving structs or unions.
llvm-svn: 246860
2015-09-04 18:34:48 +00:00
Ed Schouten e8eab68b55 Put ext_implicit_lib_function_decl in ImplicitFunctionDeclare.
If we build with -Werror=implicit-function-declaration, only implicit
function declarations of non-library functions throw compiler errors.
For library functions, we only produce a warning. There is no way to
promote both of these cases to an error without promoting other
warnings.

It makes little sense to introduce an additional compiler flag just to
control this specific warning. In my opinion it should just be part of
the same group.

llvm-svn: 246857
2015-09-04 16:07:39 +00:00
Alexey Bataev 5a1954780f [OPENMP] Fix false diagnostic on instantiation-dependent exprs for atomic constructs.
Some of instantiation-dependent expressions could cause false diagnostic to be emitted about unsupported atomic constructs. Relaxed rules for detection of incorrect expressions.

llvm-svn: 246853
2015-09-04 12:55:50 +00:00
NAKAMURA Takumi 633fc4d72b clang/test/SemaCXX/sourceranges.cpp: Fix silly expressions. Sorry for the breakage.
llvm-svn: 246850
2015-09-04 11:49:36 +00:00
NAKAMURA Takumi 9d86ef30b5 clang/test/SemaCXX/sourceranges.cpp: Appease win32. Class method is thiscall for targeting i686-(msvc|mingw32).
llvm-svn: 246849
2015-09-04 11:40:31 +00:00
Alexey Bataev caacd53dde [OPENMP] Fix for http://llvm.org/PR24674: assertion failed and and abort trap
Fix processing of shared variables with reference types in OpenMP constructs. Previously, if the variable was not marked in one of the private clauses, the reference to this variable was emitted incorrectly and caused an assertion later.

llvm-svn: 246846
2015-09-04 11:26:21 +00:00
Olivier Goffart 1ba7dc38d0 Fix the perentheses location when the constructor is called on a class that has a destructor
llvm-svn: 246844
2015-09-04 10:17:10 +00:00
NAKAMURA Takumi f6cef72f12 Fix a couple of \param(s) in r246815. [-Wdocumentation]
llvm-svn: 246838
2015-09-04 05:19:31 +00:00
Richard Smith 37e14987c6 Cleanups, no functionality change.
llvm-svn: 246837
2015-09-04 04:09:21 +00:00
Alexey Bataev a7ab1b4206 [X86-64] Allow additional register names in inline assembler.
Patch allows to recognize additional registers x8d, x8b, x8w - x15d, x15b, x15w in inline assembler, already recognized by backend
Differential Revision: http://reviews.llvm.org/D12594

llvm-svn: 246835
2015-09-04 03:42:23 +00:00
Richard Smith 332653ccf6 Fix a potential APInt memory leak when using __attribute__((flag_enum)), and
simplify the implementation a bit.

llvm-svn: 246830
2015-09-04 01:03:03 +00:00
Eric Christopher f9cdea9d74 Untabify.
llvm-svn: 246826
2015-09-04 00:15:47 +00:00
Gabor Horvath b47128aaf3 [Static Analyzer] Remove sinks from nullability checks.
Differential Revision: http://reviews.llvm.org/D12445 

llvm-svn: 246818
2015-09-03 23:16:21 +00:00
Naomi Musgrave 866af2d6d1 Refactored dtor sanitizing into EHScopeStack
Summary:
Dtor sanitization handled amidst other dtor cleanups,
between cleaning bases and fields. Sanitizer call pushed onto
stack of cleanup operations.

Reviewers: eugenis, kcc

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

Refactoring dtor sanitizing emission order.

- Support multiple inheritance by poisoning after
 member destructors are invoked, and before base
 class destructors are invoked.
- Poison for virtual destructor and virtual bases.
- Repress dtor aliasing when sanitizing in dtor.
- CFE test for dtor aliasing, and repression of aliasing in dtor
 code generation.
- Poison members on field-by-field basis, with collective poisoning
 of trivial members when possible.
- Check msan flags and existence of fields, before dtor sanitizing,
 and when determining if aliasing is allowed.
- Testing sanitizing bit fields.

llvm-svn: 246815
2015-09-03 23:02:30 +00:00
Dan Gohman c285307e14 [WebAssembly] Initial WebAssembly support in clang
This implements basic support for compiling (though not yet assembling
or linking) for a WebAssembly target. Note that ABI details are not yet
finalized, and may change.

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

llvm-svn: 246814
2015-09-03 22:51:53 +00:00
DeLesley Hutchins 445a31cd4b Thread safety analysis: the NO_THREAD_SAFETY_ANALYSIS attribute will now
disable checking of arguments to the function, which is done by
-Wthread-safety-reference.

llvm-svn: 246806
2015-09-03 21:14:22 +00:00
Alexey Samsonov c079df09a6 Add target flag to clang-cl invocation in this test.
llvm-svn: 246804
2015-09-03 20:53:14 +00:00
Yaron Keren 5bfa1084b1 Fix PR23472þ by emitting initialized variable and its guard in the same COMDAT only for ELF objects.
http://llvm.org/pr23472

Reviewed by Reid Kleckner.

llvm-svn: 246803
2015-09-03 20:33:29 +00:00
Alexey Samsonov fbe54696cc Add -target flag to Clang invocations in this test.
ASan may not be supported for the default target triple.

llvm-svn: 246795
2015-09-03 19:11:42 +00:00
Manuel Klimek e0495d987c [libclang] Return deduced type for auto type, not the one written in the source.
It used to work, but was accidentally broken by r179769.
The issue with decayed types was fixed by r190796.
So this patch partially reverts r179769, and adds more tests.

This also fixes PR 18669.

Patch by Sergey Kalinichev.

llvm-svn: 246778
2015-09-03 16:11:10 +00:00
Alexandros Lamprineas a448f04697 Implement ACLE 2.0 macros of chapters 6.4 and 6.5 for [ARM] and [Aarch64] targets.
Differential Revision: http://reviews.llvm.org/D12244

Change-Id: Iffd4e822c15e18668fe8868278230ff232ef50aa
llvm-svn: 246768
2015-09-03 14:40:57 +00:00
Daniel Sanders 4f7cd2398b [mips] Added support for choosing between traps and breaks in the integrated assembler macros.
Summary: The command line options for these are -Wa,--trap and -Wa,--break.

Patch by Scott Egerton.

Reviewers: vkalintiris, dsanders

Subscribers: llvm-commits

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

llvm-svn: 246765
2015-09-03 12:58:39 +00:00
Oliver Stannard dc2854c2f1 [ARM] Allow passing/returning of __fp16 arguments
The ACLE (ARM C Language Extensions) 2.0 allows the __fp16 type to be
used as a functon argument or return type (ACLE 1.1 did not).

The current public release of the AAPCS (2.09) states that __fp16 values
should be converted to single-precision before being passed or returned,
but AAPCS 2.10 (to be released shortly) changes this, so that they are
passed in the least-significant 16 bits of either a GPR (for base AAPCS)
or a single-precision register (for AAPCS-VFP). This does not change how
arguments are passed if they get passed on the stack.

This patch brings clang up to compliance with the latest versions of
both of these specs.

We can now set the __ARM_FP16_ARGS ACLE predefine, and we have always
been able to set the __ARM_FP16_FORMAT_IEEE predefine (we do not support
the alternative format).

llvm-svn: 246764
2015-09-03 12:40:58 +00:00
Oliver Stannard 9253f00d13 Revert 246755 as it breaks buildbots
Original commit message:
[ARM] Allow passing/returning of __fp16 arguments

The ACLE (ARM C Language Extensions) 2.0 allows the __fp16 type to be
used as a functon argument or return type (ACLE 1.1 did not).

The current public release of the AAPCS (2.09) states that __fp16 values
should be converted to single-precision before being passed or returned,
but AAPCS 2.10 (to be released shortly) changes this, so that they are
passed in the least-significant 16 bits of either a GPR (for base AAPCS)
or a single-precision register (for AAPCS-VFP). This does not change how
arguments are passed if they get passed on the stack.

This patch brings clang up to compliance with the latest versions of
both of these specs.

We can now set the __ARM_FP16_ARGS ACLE predefine, and we have always
been able to set the __ARM_FP16_FORMAT_IEEE predefine (we do not support
the alternative format).

llvm-svn: 246760
2015-09-03 11:46:24 +00:00
Alexey Bataev b500101e1c [OPENMP] Fix for http://llvm.org/PR24687: ICE on compilation of R package TPmsm.
Fixed capturing of VLAs in 'private' clause of the OpenMP directives.

llvm-svn: 246757
2015-09-03 10:21:46 +00:00
Oliver Stannard ee0286201c [ARM] Allow passing/returning of __fp16 arguments
The ACLE (ARM C Language Extensions) 2.0 allows the __fp16 type to be
used as a functon argument or return type (ACLE 1.1 did not).

The current public release of the AAPCS (2.09) states that __fp16 values
should be converted to single-precision before being passed or returned,
but AAPCS 2.10 (to be released shortly) changes this, so that they are
passed in the least-significant 16 bits of either a GPR (for base AAPCS)
or a single-precision register (for AAPCS-VFP). This does not change how
arguments are passed if they get passed on the stack.

This patch brings clang up to compliance with the latest versions of
both of these specs.

We can now set the __ARM_FP16_ARGS ACLE predefine, and we have always
been able to set the __ARM_FP16_FORMAT_IEEE predefine (we do not support
the alternative format).

llvm-svn: 246755
2015-09-03 09:34:53 +00:00
Alexey Bataev 7371aa365c [OPENMP 4.1] Codegen for extended format of 'if' clause.
Fixed codegen for extended format of 'if' clauses with special 'directive-name-modifier' + ast-print tests for extended format of 'if' clause.

llvm-svn: 246748
2015-09-03 08:45:56 +00:00
Alexey Bataev 6b8046addf [OPENMP 4.1] Parsing/sema analysis for extended format of 'if' clause.
OpenMP 4.1 added special 'directive-name-modifier' to the 'if' clause.
Format of 'if' clause is as follows:
```
if([ directive-name-modifier :] scalar-logical-expression)
```

The restriction rules are also changed.
1. If any 'if' clause on the directive includes a 'directive-name-modifier' then all 'if' clauses on the directive must include a 'directive-name-modifier'.
2. At most one 'if' clause without a 'directive-name-modifier' can appear on the directive.
3. At most one 'if' clause with some particular 'directive-name-modifier' can appear on the directive.

'directive-name-modifier' is important for combined directives and allows to separate conditions in 'if' clause for simple sub-directives in combined directive. This 'directive-name-modifier' identifies the sub-directive to which this 'if' clause must be applied.

llvm-svn: 246747
2015-09-03 07:23:48 +00:00
Douglas Katzman 1a050c8aca Remove inadvertent debug output from prior change.
llvm-svn: 246715
2015-09-02 21:18:10 +00:00
Douglas Katzman 7f43af57db Use new utility function to clean leading junk from pathnames. NFC
llvm-svn: 246714
2015-09-02 21:14:53 +00:00
Anton Yartsev 9550590711 [analyzer] Refactoring: bring together scan-build options and environment variables.
Full list of changes:
- all scan-build command-line arguments are now kept in %Options hash.
- most of environment variables scan-build operates with are stored in %EnvVars hash.
- moved processing of command-line arguments to the ProcessArgs subroutine.

llvm-svn: 246710
2015-09-02 21:01:59 +00:00
Eric Christopher 86fdc85181 Migrate the target attribute parsing code to returning an instance
every time it's called rather than attempting to cache the result.
It's unlikely to be called frequently and the overhead of using
it in the first place is already factored out.

llvm-svn: 246706
2015-09-02 20:40:12 +00:00
Sean Silva 0df0391fb6 [modules] Tighten up this test a bit.
llvm-svn: 246702
2015-09-02 20:16:09 +00:00
Eric Christopher 54f29bc2cd Update comment for AdditionalMembers with a note to avoid using
additional data members in attributes as they'll leak and provide
some guidance as to where they should be allocated if necessary.

llvm-svn: 246701
2015-09-02 20:13:41 +00:00
Ivan Krasin 4c3f237edb Do not include default sanitizer blacklists into -M/-MM/-MD/-MMD output.
Summary:
Do not include default sanitizer blacklists into -M/-MM/-MD/-MMD output.

Introduce a frontend option -fdepfile-entry, and only insert them
for the user-defined sanitizer blacklists. In frontend, grab ExtraDeps
from -fdepfile-entry, instead of -fsanitize-blacklist.

Reviewers: rsmith, pcc

Subscribers: cfe-commits

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

llvm-svn: 246700
2015-09-02 20:02:38 +00:00
Sanjay Patel a24296b459 add __builtin_unpredictable and convert to metadata
This patch depends on r246688 (D12341).

The goal is to make LLVM generate different code for these functions for a target that
has cheap branches (see PR23827 for more details):

int foo();

int normal(int x, int y, int z) {
   if (x != 0 && y != 0) return foo();
   return 1;
}

int crazy(int x, int y) {
   if (__builtin_unpredictable(x != 0 && y != 0)) return foo();
   return 1;
}

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

llvm-svn: 246699
2015-09-02 20:01:30 +00:00
Richard Smith f8c3255843 [modules] Don't waste time reading in the names the module file writer gave to blocks. We don't need these names, and decoding the corresponding bitcode has a significant cost.
llvm-svn: 246680
2015-09-02 17:45:54 +00:00
David Majnemer b33cd908d4 [MS ABI] Number unnamed TagDecls which aren't externally visible
TagDecls (structs, enums, etc.) may have the same name for linkage
purposes of one another; to disambiguate, we add a number to the mangled
named.  However, we didn't do this if the TagDecl has a pseudo-name for
linkage purposes (it was defined alongside a DeclaratorDecl or a
TypeNameDecl).

This fixes PR24651.

llvm-svn: 246659
2015-09-02 15:50:38 +00:00
Benjamin Kramer 9b81903607 [OpenMP] Make helper functoin static. NFC.
llvm-svn: 246657
2015-09-02 15:31:05 +00:00
Douglas Katzman 15172619d4 [Shave]: pass through more clang options to moviCompile
llvm-svn: 246652
2015-09-02 13:42:43 +00:00
Douglas Katzman b76a3dfb7d [Sparc]: GCCInstallationDetector should not care if little-endian
llvm-svn: 246650
2015-09-02 13:33:42 +00:00
Aaron Ballman 7f0c25b6c9 Silence a -Wsign-compare warning; NFC.
llvm-svn: 246646
2015-09-02 12:50:12 +00:00
Vedant Kumar 2ea5393ca1 [Sema] Avoid crash on tag-type mismatch (Fixes PR24610)
Differential Revision: http://reviews.llvm.org/D12444

llvm-svn: 246618
2015-09-02 03:27:15 +00:00
Eric Christopher bb0cef6e9c Migrate the target attribute parsing code into an extension off of
the main attribute and cache the results so we don't have to parse
a single attribute more than once.

This reapplies r246596 with a fix for an uninitialized class member,
and a couple of cleanups and formatting changes.

llvm-svn: 246610
2015-09-02 00:12:02 +00:00
Hubert Tong 2cded44d82 Fix assertion failure in TransformOpaqueValueExpr
Summary:
`OpaqueValueExpr`s may not have a source expression (as in the case when
they are created due to a default argument error).
This can cause an assertion failure in `TransformOpaqueValueExpr` during
template instantiation.

This patch fixes the assertion failure.

Reviewers: hfinkel, rsmith

Subscribers: fraggamuffin, cfe-commits

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

Patch by Rachel Craik!

llvm-svn: 246600
2015-09-01 22:50:31 +00:00
Eric Christopher bf91fbab3a Revert "Migrate the target attribute parsing code into an extension off of"
This is failing in release mode. Revert while I figure out what's happening.

This reverts commit r246596.

llvm-svn: 246598
2015-09-01 22:37:03 +00:00
Eric Christopher 21213a7040 Migrate the target attribute parsing code into an extension off of
the main attribute and cache the results so we don't have to parse
a single attribute more than once.

llvm-svn: 246596
2015-09-01 22:03:58 +00:00
Eric Christopher b57804a134 Use hasAttr, not getAttr if we're just checking for presence.
llvm-svn: 246595
2015-09-01 22:03:56 +00:00
David Majnemer b8ed364d8a [MS ABI] Switch to the CRC implementation in LLVM
We now have an implementation of the CRC in LLVM's libSupport.  Let's
consolidate around that one.

llvm-svn: 246591
2015-09-01 21:24:07 +00:00
Nico Weber ee1cff5fab Make trunk release notes point to 3.7, not 3.6
llvm-svn: 246589
2015-09-01 21:13:14 +00:00
Richard Smith d88a7f1a92 Re-commit r246497 (and dependent changes r246524 and r246521), reverted in
r246546, with a workaround for an MSVC 2013 miscompile and an MSVC 2015
rejects-valid.

Original commit message:

[modules] Rework serialized DeclContext lookup table management. Instead of
walking the loaded ModuleFiles looking for lookup tables for the context, store
them all in one place, and merge them together if we find we have too many
(currently, more than 4). If we do merge, include the merged form in our
serialized lookup table, so that downstream readers never need to look at our
imports' tables.

This gives a huge performance improvement to builds with very large numbers of
modules (in some cases, more than a 2x speedup was observed).

llvm-svn: 246582
2015-09-01 20:35:42 +00:00
Eli Bendersky 8ea8b343c4 Fix typo in test
llvm-svn: 246573
2015-09-01 18:56:19 +00:00
Eric Christopher e9cdcaee7b Pull initFeatureMap out of line now that it's used in multiple places.
llvm-svn: 246565
2015-09-01 18:13:20 +00:00
Aaron Ballman 6924dcdf6f Add a new frontend warning for referencing members from the handler of a constructor or destructor function-try-block, which is UB in C++.
This corresponds to the CERT secure coding rule ERR53-CPP.

llvm-svn: 246548
2015-09-01 14:49:24 +00:00
Aaron Ballman 6a4a210126 Reverting r246497 (which requires also reverting r246524 and r246521 to avoid merge conflicts). It broke the build on MSVC 2015. It also broke an MSVC 2013 bot with testing issues.
llvm\tools\clang\lib\serialization\MultiOnDiskHashTable.h(117):
error C2065: 'Files': undeclared identifier

http://bb.pgr.jp/builders/ninja-clang-i686-msc18-R/builds/2917

llvm-svn: 246546
2015-09-01 13:24:39 +00:00
Richard Smith 6307849666 [modules] When emitting line tables, only emit filenames that are actually referenced by the entries that we emit.
llvm-svn: 246534
2015-09-01 07:41:55 +00:00
Richard Smith b5aaf5a57a Don't use fprintf to emit this diagnostic!
llvm-svn: 246526
2015-09-01 02:35:58 +00:00
Richard Smith 86f14e09a6 Use a more appropriate way of writing 1.
llvm-svn: 246524
2015-09-01 02:02:09 +00:00
David Majnemer 7f0674d6f0 [MS ABI] Cleanup get*ForUnnamedTagDecl
Use "lookup" instead of operator[], it will not perform unnecessary
insertions.  No functionality change is intended.

llvm-svn: 246523
2015-09-01 01:53:07 +00:00
Richard Smith 7fa450c6ae [modules] Preserve DeclID order when merging lookup tables to give a more
predictable diagnostic experience. The hash-of-DeclID order we were using
before gave different results on Win32 due to a different predefined
declaration of __builtin_va_list.

llvm-svn: 246521
2015-09-01 01:37:34 +00:00
Yaron Keren a8dde6c83f Fix path seperator for Windows.
llvm-svn: 246520
2015-09-01 01:29:13 +00:00
Hal Finkel 65e1e4dbe0 [PowerPC] Support __builtin_ppc_get_timebase
GCC 4.8+ has a PowerPC-specific intrinsic, __builtin_ppc_get_timebase, to do
what Clang's __builtin_readcyclecounter does. For compatibility with code that
uses GCC's spelling (including glibc), support it as well.

Partially fixes PR23681.

llvm-svn: 246510
2015-08-31 23:55:19 +00:00
Eric Christopher dec31befef Revert "Pull the target attribute parsing out of CGCall and onto TargetInfo."
This reverts commit r246468 while we figure out what to do about Basic and AST.

llvm-svn: 246508
2015-08-31 23:19:55 +00:00
Richard Smith fa715655ee [modules] Add some missing blockinfo records.
llvm-svn: 246504
2015-08-31 22:43:10 +00:00
Richard Smith 9ce2b45936 [modules] Rework serialized DeclContext lookup table management. Instead of
walking the loaded ModuleFiles looking for lookup tables for the context, store
them all in one place, and merge them together if we find we have too many
(currently, more than 4). If we do merge, include the merged form in our
serialized lookup table, so that downstream readers never need to look at our
imports' tables.

This gives a huge performance improvement to builds with very large numbers of
modules (in some cases, more than a 2x speedup was observed).

llvm-svn: 246497
2015-08-31 22:17:11 +00:00
Hans Wennborg 2151d12ec0 Fix CHECK directives that weren't checking.
llvm-svn: 246492
2015-08-31 21:48:52 +00:00
Gabor Horvath 742fd989b5 Revert r246345 until an assertion is fixed.
llvm-svn: 246479
2015-08-31 20:10:35 +00:00
Rafael Espindola c53c5b13be Stop hardcoding GCC paths in crt/ld.so lookup.
This patch refactors the code to use the GCC installation detector
(modified so that it works in Solaris), and uses
ToolChain::GetFilePath everywhere once it works.

Patch by Xan López <xan@igalia.com>!

llvm-svn: 246473
2015-08-31 19:17:51 +00:00
David Majnemer 0035052729 [MS ABI] Correctly mangle classes without names for linkage purposes
A class without a name for linkage purposes gets a name along the lines
of <unnamed-type-foo> where foo is either the name of a declarator which
defined it (like a variable or field) or a
typedef-name (like a typedef or alias-declaration).

We handled the declarator case correctly but it would fall down during
template instantiation if the declarator didn't share the tag's type.
We failed to handle the typedef-name case at all.

Instead, keep track of the association between the two and keep it up to
date in the face of template instantiation.

llvm-svn: 246469
2015-08-31 18:48:39 +00:00
Eric Christopher d40722e267 Pull the target attribute parsing out of CGCall and onto TargetInfo.
Also:
  - Add a typedef to make working with the result easier.
  - Update callers to use the new function.
  - Make initFeatureMap out of line.

llvm-svn: 246468
2015-08-31 18:39:22 +00:00
Eric Christopher a8a14c3d88 Pull out the ppc incompatible features check into a separate function.
llvm-svn: 246467
2015-08-31 18:39:16 +00:00
Jingyue Wu 2d69f9608e [CUDA] fix codegen for __nvvm_atom_min/max_gen_u*
Summary: Clang should emit "atomicrmw umin/umax" instead of "atomicrmw min/max".

Reviewers: eliben, tra

Subscribers: llvm-commits

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

llvm-svn: 246455
2015-08-31 17:25:51 +00:00
Benjamin Kramer ec5f51ffe4 [OpenMP] base specific_clause_iterator on iterator_adaptor_base.
Removes some boilerplate code. No functionality change intended.

llvm-svn: 246452
2015-08-31 16:45:35 +00:00
Andrey Bokhanko cab5858e1b PR17829: Proper diagnostic of mangled names conflicts
Proper diagnostic and resolution of mangled names conflicts between C++ methods
and C functions. This patch implements support for functions/methods only;
support for variables is coming separately.

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

llvm-svn: 246438
2015-08-31 13:20:44 +00:00
Igor Breger b5ba2319f6 AVX-512: Changed cnt parameter in valignq/d intrinsic from i8 to i32 according to the Intel Spec
Differential Revision: http://reviews.llvm.org/D12274

llvm-svn: 246430
2015-08-31 11:15:06 +00:00
Alexey Bataev d6fdc8b685 [OPENMP 4.0] Codegen for array sections.
Added codegen for array section in 'depend' clause of 'task' directive. It emits to pointers, one for the begin of array section and another for the end of array section. Size of the section is calculated as (end + 1 - start) * sizeof(basic_element_type).

llvm-svn: 246422
2015-08-31 07:32:19 +00:00
Alexey Bader f961e755b1 [OpenCL] Improve diagnostics detecting implicit vector conversion.
Reviewers: pekka.jaaskelainen

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

llvm-svn: 246393
2015-08-30 18:06:39 +00:00
Yaron Keren 2dbe3440d5 Fix test for Release builds, the label form is <label>:14, not <label>14.
llvm-svn: 246391
2015-08-30 17:46:43 +00:00
Yaron Keren 43e184ee0c Make test resistant to false matches of numbered (unnamed) labels inside other numbers.
In release builds labels are numbers. Matching just the number may result
in false matches where the label is contained in other numbers, such as
14 inside [114 x i8]. A stricter match requiring start of line or > character
before the label avoids these false matches.

llvm-svn: 246385
2015-08-30 15:24:46 +00:00
Benjamin Kramer fc600dc2ec [OpenMP] Make the filetered clause iterator a real iterator and type safe.
This replaces the filtered generic iterator with a type-specfic one based
on dyn_cast instead of comparing the kind enum. This allows us to use
range-based for loops and eliminates casts. No functionality change
intended.

llvm-svn: 246384
2015-08-30 15:12:28 +00:00
Chandler Carruth d96f37a772 Update for several APIs in LLVM that now use StringRefs rather than
const char pointers. In turn, push this through Clang APIs as well,
simplifying a number of bits of code that was handling the oddities of
nullptrs.

llvm-svn: 246375
2015-08-30 07:51:18 +00:00
Chandler Carruth aa0caeb431 Update for API change in LLVM: ARMTargetParser class is just the ARM
namespace.

llvm-svn: 246368
2015-08-30 02:16:36 +00:00
Simon Pilgrim e7708a84b9 [X86] Reapplied r246204, r246206, r246211, r246223
(Re)added debug codegen test for F16C, FMA4, XOP + 3DNow! intrinsics

Part of PR24590

llvm-svn: 246363
2015-08-29 17:13:40 +00:00
David Majnemer c378ca5043 [AST] Don't crash when comparing incomplete object
We cannot tell if an object is past-the-end if its type is incomplete.
Zero sized objects satisfy past-the-end criteria and our object might
turn out to be such an object.

This fixes PR24622.

llvm-svn: 246359
2015-08-29 08:32:55 +00:00
Eric Christopher a15a35e552 Add a check for a function we're not testing.
llvm-svn: 246355
2015-08-29 02:59:37 +00:00
Hans Wennborg a37b065e8f Follow-up to r246338: use getParentFunctionOrMethod
llvm-svn: 246348
2015-08-28 22:56:21 +00:00
Richard Smith d35cb054c9 PR24612: Don't bail out of checking a constexpr function before checking
whether it can ever produce a constant expression in the case where it has a
void return type and no return statements.

llvm-svn: 246347
2015-08-28 22:33:53 +00:00
Eric Christopher 007b0a0e27 Fold TargetInfo::handleUserFeatures into TargetInfo::initFeatureMap.
llvm-svn: 246346
2015-08-28 22:32:01 +00:00
Devin Coughlin 35d5dd2986 [analyzer] When memcpy'ing into a fixed-size array, do not invalidate entire region.
Change the analyzer's modeling of memcpy to be more precise when copying into fixed-size
array fields. With this change, instead of invalidating the entire containing region the
analyzer now invalidates only offsets for the array itself when it can show that the
memcpy stays within the bounds of the array.

This addresses false positive memory leak warnings of the kind reported by
krzysztof in https://llvm.org/bugs/show_bug.cgi?id=22954

A patch by Pierre Gousseau!

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

llvm-svn: 246345
2015-08-28 22:26:05 +00:00
Hans Wennborg 6eaa8323a8 Allow TLS vars in dllimport/export functions; only inline dllimport functions when safe (PR24593)
This patch does two things:

1) Don't error about dllimport/export on thread-local static local variables.
   We put those attributes on static locals in dllimport/export functions
   implicitly in case the function gets inlined. Now, for TLS variables this
   is a problem because we can't import such variables, but it's a benign
   problem becase:

2) Make sure we never inline a dllimport function TLS static locals. In fact,
   never inline a dllimport function that references a non-imported function
   or variable (because these are not defined in the importing library). This
   seems to match MSVC's behaviour.

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

llvm-svn: 246338
2015-08-28 21:47:01 +00:00
Aaron Ballman 6e14652550 Updating the AST matcher documentation with a new entry; NFC.
llvm-svn: 246324
2015-08-28 19:39:56 +00:00
Renato Golin b9365ae36a Revert "[X86][3DNow] Added debug codegen test for 3DNow! intrinsics"
This reverts commit r246223, as it broke all ARM/AArch64 bots.

llvm-svn: 246323
2015-08-28 19:39:29 +00:00
Aaron Ballman 6c79f352b8 Adding an AST matcher for namespaceAliasDecl.
llvm-svn: 246322
2015-08-28 19:39:21 +00:00
Renato Golin 0b4112341b Revert "[X86][XOP] Added debug codegen test for XOP intrinsics"
This reverts commit r246211, as it broke all ARM/AArch64 bots.

llvm-svn: 246321
2015-08-28 19:38:05 +00:00
Renato Golin a3265f5be7 Revert "[X86][FMA4] Added debug codegen test for FMA4 intrinsics"
This reverts commit r246206, as it broke all ARM/AArch64 bots.

llvm-svn: 246320
2015-08-28 19:36:27 +00:00
Renato Golin b44e54170e Revert "[X86][F16C] Added debug codegen test for F16C intrinsics"
This reverts commit r246204, as it was breaking all ARM/AArch64 bots.

llvm-svn: 246319
2015-08-28 19:34:53 +00:00
Sanjay Patel 69e7f6e436 fix typo; NFC
llvm-svn: 246303
2015-08-28 14:42:54 +00:00
Sylvestre Ledru c0babf2bc0 Support Debian s390x multiarch paths
Summary: Patch by Steven Chamberlain <steven@pyro.eu.org>

Reviewers: uweigand

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

llvm-svn: 246295
2015-08-28 12:26:09 +00:00
Daniel Jasper ad5b7962c9 Revert "[OPENMP 4.0] Codegen for array sections."
The test is currently failing on bots:
http://lab.llvm.org:8080/green/job/clang-stage1-cmake-RA-incremental_check/12747/

llvm-svn: 246288
2015-08-28 08:42:22 +00:00
Steven Wu 5528da76ef Revert r246214 and r246213
These two commits causes llvm LTO bootstrap to hang in ScalarEvolution.

llvm-svn: 246282
2015-08-28 07:14:10 +00:00
Alexey Bataev 117fb35cf7 [OPENMP 4.0] Codegen for array sections.
Added codegen for array section in 'depend' clause of 'task' directive. It emits to pointers, one for the begin of array section and another for the end of array section. Size of the section is calculated as (end + 1 - start) * sizeof(basic_element_type).

llvm-svn: 246278
2015-08-28 06:09:05 +00:00
Richard Smith 52a980a97f PR24597: Fix in-place evaluation of call expressions to provide a proper "this"
pointer to an RVO construction of a returned object.

llvm-svn: 246263
2015-08-28 02:43:42 +00:00
Eric Christopher e6b6488c70 Instead of duplicating code, call the base implementation.
llvm-svn: 246260
2015-08-28 02:14:00 +00:00
Eric Christopher ef1e295a8c Merge the two feature map setting functions into a single function
and replace all callers.

llvm-svn: 246259
2015-08-28 02:13:58 +00:00
Richard Trieu a1d7ece05c Fix macro backtrace printing.
Sometimes, a macro that expands to another macro name will not be printed in
the macro backtrace.  This patch finds the missed macro expansions and prints
them.  Fixes PR16799

llvm-svn: 246237
2015-08-27 23:38:45 +00:00
Adrian Prantl 3a884fa9e3 CGDebugInfo: Instead of uniquing RetainedTypes, just refrain from retaining
them more than once. (NFC)

llvm-svn: 246231
2015-08-27 22:56:46 +00:00
Ahmed Bougacha 02b7b56af8 [X86] Bump Darwin MaxVectorAlign to 64 when AVX512 is enabled.
Without this, 64-byte vector types (__m512), specified to be 64-byte
aligned in the AVX512 draft SysV ABI, will only be 32-byte aligned.

This is analoguous to AVX, for which we accept 32-byte max alignment.

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

llvm-svn: 246230
2015-08-27 22:42:12 +00:00
Ahmed Bougacha 82b619ea68 [X86] Conditionalize Darwin MaxVectorAlign on the presence of AVX.
There's no point in using a larger alignment if we have no instructions
that would benefit from it.

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

llvm-svn: 246229
2015-08-27 22:30:38 +00:00
Ahmed Bougacha 68bf64e302 [X86] Use AVX features instead of ABI to init. SimdDefaultAlign.
The ABI string only exists to communicate with TargetCodeGenInfo.
Concretely, since we only used "avx*" ABI strings on x86_64 (as AVX
doesn't affect the i386 ABIs), this meant that, when initializing
SimdDefaultAlign, we would ignore AVX/AVX512 on i386, for no good
reason.

Instead, directly check the features. A similar change for
MaxVectorAlign will follow.

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

llvm-svn: 246228
2015-08-27 22:24:56 +00:00
Eric Christopher da89d6804c Use an explicit assignment.
llvm-svn: 246225
2015-08-27 22:20:03 +00:00
Simon Pilgrim c7eaa17fe1 [X86][3DNow] Added debug codegen test for 3DNow! intrinsics
Part of PR24590

llvm-svn: 246223
2015-08-27 22:18:09 +00:00
Richard Smith 5f55d93c84 Don't call a member function on a null pointer.
llvm-svn: 246215
2015-08-27 21:38:25 +00:00
Piotr Padlewski 81461a4350 Assume loads fix #2
There was linker problem, and it turns out that it is not always safe
to refer to vtable. If the vtable is used, then we can refer to it
without any problem, but because we don't know when it will be used or
not, we can only check if vtable is external or it is safe to to emit it
speculativly (when class it doesn't have any inline virtual functions).
It should be fixed in the future.

http://reviews.llvm.org/D12385

llvm-svn: 246214
2015-08-27 21:35:41 +00:00
Piotr Padlewski 525f746710 Generating assumption loads of vptr after ctor call (fixed)
Generating call assume(icmp %vtable, %global_vtable) after constructor
call for devirtualization purposes.

For more info go to:
http://lists.llvm.org/pipermail/cfe-dev/2015-July/044227.html

Edit:
Fixed version because of PR24479.

http://reviews.llvm.org/D11859

llvm-svn: 246213
2015-08-27 21:35:37 +00:00
Simon Pilgrim 7033a9ce33 [X86][XOP] Added debug codegen test for XOP intrinsics
Part of PR24590

llvm-svn: 246211
2015-08-27 21:32:03 +00:00
Adrian Prantl ad9a195ee9 CGDebugInfo: Factor out a getOrCreateStandaloneType() method.
Usually debug info is created on the fly while during codegen.
With this API it becomes possible to create standalone debug info
for types that are not referenced by any code, such as emitting debug info
for a clang module or for implementing something like -gfull.
Because on-the-fly debug info generation may still insert retained types
on top of them, all RetainedTypes are uniqued in CGDebugInfo::finalize().

llvm-svn: 246210
2015-08-27 21:21:19 +00:00
Simon Pilgrim 75dffb8df3 [X86][FMA4] Added debug codegen test for FMA4 intrinsics
Part of PR24590

llvm-svn: 246206
2015-08-27 20:41:45 +00:00
Simon Pilgrim 9362270f78 [X86][F16C] Added debug codegen test for F16C intrinsics
Part of PR24590

llvm-svn: 246204
2015-08-27 20:34:02 +00:00
Eric Christopher 53b2afa28f Remove a dead assert, we'd have gotten the case above.
llvm-svn: 246202
2015-08-27 20:32:24 +00:00
Simon Pilgrim a79dfb3223 [X86] Add __builtin_ia32_undef* intrinsics to test
Minor tweak to rL246083

llvm-svn: 246200
2015-08-27 20:29:13 +00:00
Eric Christopher 3751bce2a9 Target attribute syntax compatibility fix - gcc uses no- rather than mno-.
llvm-svn: 246197
2015-08-27 20:05:48 +00:00
Eric Christopher 5d2db529cb Rename this file to have a processor suffix to help identify.
llvm-svn: 246196
2015-08-27 20:05:46 +00:00
Eric Christopher 3a98b3c1a5 Rewrite the code generation handling for function feature and cpu attributes.
A couple of changes here:

a) Do less work in the case where we don't have a target attribute on the
function. We've already canonicalized the attributes for the function -
no need to do more work.

b) Use the newer canonicalized feature adding functions from TargetInfo
to do the work when we do have a target attribute. This enables us to diagnose
some warnings in the case of conflicting written attributes (only ppc does
this today) and also make sure to get all of the features for a cpu that's
listed rather than just change the cpu.

Updated all testcases accordingly and added a new testcase to verify that we'll
error out on ppc if we have some incompatible options using the existing diagnosis
framework there.

llvm-svn: 246195
2015-08-27 19:59:34 +00:00
Artem Belevich 5ef02c2db7 [CUDA] Check register names on appropriate side of cuda compilation only.
Differential Revision: http://reviews.llvm.org/D11950

llvm-svn: 246193
2015-08-27 19:54:21 +00:00
Adrian Prantl 6b21ab21d1 Add a -gmodules option to the driver and a -dwarf-ext-refs to cc1
to enable the use of external type references in the debug info
(a.k.a. module debugging).

The driver expands -gmodules to "-g -fmodule-format=obj -dwarf-ext-refs"
and passes that to cc1. All this does at the moment is set a flag
codegenopts.

http://reviews.llvm.org/D11958

llvm-svn: 246192
2015-08-27 19:46:20 +00:00
Tyler Nowicki 8cb274ed0d Improve options printed on vectorization analysis diagnostics.
The LLVM patch changes the analysis diagnostics produced when loops with            
floating-point recurrences or memory operations are identified. The new messages
say "cannot prove it is safe to reorder * operations; allow reordering by       
specifying #pragma clang loop vectorize(enable)". Depending on the type of      
diagnostic the message will include additional options such as ffast-math or    
__restrict__.                                                                   

llvm-svn: 246189
2015-08-27 18:58:34 +00:00
Gabor Horvath e9984b28ef [Static Analyzer] BugReporter.cpp:2869: Assertion failed: !RemainingNodes.empty() && "No error node found in the trimmed graph"
The assertion is caused by reusing a “filler” ExplodedNode as an error node.
The “filler” nodes are only used for intermediate processing and are not
essential for analyzer history, so they can be reclaimed when the
ExplodedGraph is trimmed by the “collectNode” function. When a checker finds a
bug, they generate a new transition in the ExplodedGraph. The analyzer will
try to reuse the existing predecessor node. If it cannot, it creates a new
ExplodedNode, which always has a tag to uniquely identify the creation site.
The assertion is caused when the analyzer reuses a “filler” node.

In the test case, some “filler” nodes were reused and then reclaimed later
when the ExplodedGraph was trimmed. This caused an assertion because the node
was needed to generate the report. The “filler” nodes should not be reused as
error nodes. The patch adds a constraint to prevent this happening, which
solves the problem and makes the test cases pass.

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

Patch by Ying Yi!

llvm-svn: 246188
2015-08-27 18:57:00 +00:00
Charles Li 430db1e717 [Tests] Modified Lit Tests to be C++11 compatibile
This 2nd patch should not change the test results, but it is useful if clang's
default C++ language is ever changed from gnu++98.

llvm-svn: 246183
2015-08-27 18:49:15 +00:00
Gabor Horvath 8d3ad6b617 [Static Analyzer] Make NonNullParamChecker emit implicit null dereference events.
Differential Revision: http://reviews.llvm.org/D11433

llvm-svn: 246182
2015-08-27 18:49:07 +00:00
Eric Christopher 1c07d8ce83 const-ify TargetInfo::handleUserFeatures.
llvm-svn: 246180
2015-08-27 18:42:57 +00:00
Artem Belevich f8144ab44f [CUDA] Improve CUDA compilation pipeline creation.
Current implementation tries to guess which Action will result in a
job which needs to incorporate device-side GPU binaries. The guessing
was attempting to work around the fact that multiple actions may be
combined into a single compiler invocation. If CudaHostAction ends up
being combined (and thus bypassed during action list traversal) no
device-side actions it pointed to were processed. The guessing worked
for most of the usual cases, but fell apart when external assembler
was used.

This change removes the guessing and makes sure we create and pass
device-side jobs regardless of how the jobs get combined.

* CudaHostAction is always inserted either at Compile phase or the
  FinalPhase of current compilation, whichever happens first.
* If selectToolForJob combines CudaHostAction with other actions, it
  passes info about CudaHostAction up to the caller
* When it sees that CudaHostAction got combined with other actions
  (and hence will never be passed to BuildJobsForActions),
  BuildJobsForActions creates device-side jobs the same way they would
  be created if CudaHostAction was passed to BuildJobsForActions
  directly.
* Added two more test cases to make sure GPU binaries are passed to
  correct jobs.

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

llvm-svn: 246174
2015-08-27 18:10:41 +00:00
Daniel Jasper 7b259cda96 clang-format: Don't let a leading "template <..>" lead to wrapped initializers.
Before:
  Constructor() : initializer(0) {}

  template <typename T>
  Constructor()
      : initializer(0) {}

After:
  Constructor() : initializer(0) {}

  template <typename T>
  Constructor() : initializer(0) {}

llvm-svn: 246146
2015-08-27 11:59:31 +00:00
Eric Christopher 2b4a725e0a Pass in a cpu to initDefaultFeatures so that we can share this code
with multiple uses of feature map construction.

Note: We could make this a static function on TargetInfo if we
fix the x86 port needing to check the triple in an isolated case.

llvm-svn: 246128
2015-08-27 00:05:52 +00:00
Eric Christopher c50738f139 const-ify X86TargetInfo::getCPUKind.
llvm-svn: 246127
2015-08-27 00:05:50 +00:00
Richard Smith a06c7e6da7 [modules] The key to a DeclContext name lookup table is not actually a
DeclarationName (because all ctor names are considered the same, and so on).
Reflect this in the type used as the lookup table key. As a side-effect, remove
one copy of the duplicated code used to compute the hash of the key.

llvm-svn: 246124
2015-08-26 23:55:49 +00:00
Eric Christopher b39e44b3f4 Pull out cpu string -> enum parsing for x86 as a separate function,
this is going to see use shortly in unifying feature set construction.

llvm-svn: 246122
2015-08-26 23:42:18 +00:00
Gabor Horvath 28690925ed [Static Analyzer] Checks to catch nullability related issues.
Differential Revision: http://reviews.llvm.org/D11468

llvm-svn: 246105
2015-08-26 23:17:43 +00:00
Duncan P. N. Exon Smith 8cd9d7acb2 DI: Update DISubprogram testcases after LLVM r246098
llvm-svn: 246099
2015-08-26 22:50:48 +00:00
Duncan P. N. Exon Smith 31d38f70ea DI: Clarify meaning of createTempFunctionFwdDecl() arg, NFC
I stared at `false /*declaration*/` for quite some time before giving up
and checking the actual function to see what it meant.  Replacing with
`/* isDefinition = */ false` to save myself effort later.

llvm-svn: 246095
2015-08-26 22:21:09 +00:00
Ahmed Bougacha 5946ca4fc4 [ARM] Mark mcr/mrc builtin operands as required-immediate.
An early error message is better than the "cannot select" alternative.

llvm-svn: 246094
2015-08-26 22:21:07 +00:00
Charles Li 2af8f46030 Corrected 3 typos. NFC
llvm-svn: 246093
2015-08-26 22:13:30 +00:00
Reid Kleckner 14e96b4930 [ms-inline-asm] Add field access to MS inline asm identifier lookup
Now we can parse code like this:
  struct A {
    int field;
  };
  int f(A o) {
    __asm mov eax, o.field
  }

Fixes PR19117.

llvm-svn: 246088
2015-08-26 21:57:20 +00:00
Simon Pilgrim 5aba9925c0 [X86][SSE] Add _mm_undefined_* intrinsics
Added missing SSE/AVX 'undefined' intrinsics (PR24040):

_mm_undefined_pd, _mm_undefined_ps + _mm_undefined_si128
_mm256_undefined_pd, _mm256_undefined_ps + _mm256_undefined_si256
_mm512_undefined, _mm512_undefined_ps, _mm512_undefined_pd + _mm512_undefined_epi32

Added builtin intrinsicss:

__builtin_ia32_undef128, __builtin_ia32_undef256 + __builtin_ia32_undef512

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

llvm-svn: 246083
2015-08-26 21:17:12 +00:00
Akira Hatanaka 9d99bb50c4 [ARM] Error out if float-ab=hard and abi=apcs-gnu on macho platforms.
Error out if -mfloat-abi=hard or -mhard-float is specified on the command
line and the target ABI is APCS. Previously clang issued no warnings or
errors and just passed the option to the backend, which had no effect on
code generation for targets using APCS.

This commit corrects the patch commited in r245866, which didn't take into
account the fact that not all darwin targets use APCS.

rdar://problem/22257950

http://reviews.llvm.org/D12344

llvm-svn: 246054
2015-08-26 19:00:11 +00:00
Derek Schuff 9afb05024d Change Native Client x86 usr include and link path to match SDK expectations
GNU multilib style uses x86_64-nacl/include and x86_64-nacl/usr/include
but the SDK expects i686-nacl/usr/include for its files. Change the driver
to use this.

Fixes https://code.google.com/p/nativeclient/issues/detail?id=4108

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

llvm-svn: 246040
2015-08-26 17:14:08 +00:00
Samuel Benzaquen f8ec454f7d [ASTMatchers] Add type matcher for SubstTemplateTypeParmType.
llvm-svn: 246037
2015-08-26 16:15:59 +00:00
Eric Christopher 610fe11ad1 Convert a bunch of loops to ranged-for and clean up accordingly.
llvm-svn: 246027
2015-08-26 08:21:55 +00:00
Yaron Keren 8dec46cf5a Make FileManager::getFileSystemOptions consistent with CompilerInstance::getFileSystemOpts
and CompilerInvocation::getFileSystemOpts by renaming it to getFileSystemOpts,
marking the const-returning access method const and adding a non-const version,
making the function prototypes identical to CompilerInstance::getFileSystemOpts.

llvm-svn: 246026
2015-08-26 08:10:22 +00:00
Eric Christopher c6adfa1f3a Group some of the inline assembly related function prototypes near
each other.

llvm-svn: 246024
2015-08-26 07:29:58 +00:00
Eric Christopher d50e2e6397 Remove dead code associated with parsing and setting ABI based on
string name.

llvm-svn: 246021
2015-08-26 07:01:33 +00:00
Eric Christopher 1d3cbfa1c1 Remove a TODO that isn't going to get fixed in this way.
llvm-svn: 246020
2015-08-26 07:01:30 +00:00
David Majnemer d39bcaed21 [Sema] Don't assume CallExpr::getDirectCallee will succeed
We tried to provide a very nice diagnostic when diagnosing an assignment
to a const int & produced by a function call.  However, we cannot always
determine what function was called.

This fixes PR24568.

llvm-svn: 246014
2015-08-26 05:13:19 +00:00
Eric Christopher b39156d068 Update file comment to more accurately describe what's implemented.
llvm-svn: 246006
2015-08-26 04:23:11 +00:00
Nathan Wilson e23a9a4514 Modify DeclaratorChuck::getFunction to be passed an Exception Specification SourceRange
Summary:
- Store the exception specification range's begin and end SourceLocation in DeclaratorChuck::FunctionTypeInfo. These SourceLocations can be used in a FixItHint Range.
- Add diagnostic; function concept having an exception specification.


Reviewers: hubert.reinterpretcast, fraggamuffin, faisalv, aaron.ballman, rsmith

Subscribers: cfe-commits

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

llvm-svn: 246005
2015-08-26 04:19:36 +00:00
Ted Kremenek 9589caf04d Add missing newline.
llvm-svn: 246003
2015-08-26 03:11:31 +00:00
Ahmed Bougacha beb3a9a970 [Headers] Require x86-registered for r245987 codegen tests.
llvm-svn: 245992
2015-08-25 23:42:55 +00:00
Ahmed Bougacha e9abaad105 [Headers][X86] Add -O0 assembly tests for avx2 intrinsics.
We agreed for r245605 that, as long as we don't affect -O0 codegen
too much, it's OK to use native constructs rather than intrinsics.
Let's test that, starting with AVX2 here.

See PR24580.

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

llvm-svn: 245987
2015-08-25 23:09:05 +00:00
Nick Lewycky e283c5529e Make sure that we evaluate __attribute__((enable_if)) on a method with no overloads. Patch by Ettore Speziale!
llvm-svn: 245985
2015-08-25 22:33:16 +00:00
Nick Lewycky 08426e2098 Clarify the error message when the reason the conversion is not viable is because the returned value does not match the function return type.
llvm-svn: 245979
2015-08-25 22:18:46 +00:00
Simon Pilgrim fbb8904411 [X86] Remove unnecessary MMX declarations from Intrin.h
As discussed in PR23648 - the intrinsics _m_from_int, _m_to_int and _m_prefetch are defined in mmintrin.h and prfchwintrin.h so we don't need to in Intrin.h

Added tests for _m_from_int and _m_to_int

D11338 already added a test for _m_prefetch

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

llvm-svn: 245975
2015-08-25 21:27:46 +00:00
Nico Weber 8cdb3f90ef Revert r245879. Speculative, might have caused crbug.com/524604
llvm-svn: 245965
2015-08-25 18:43:32 +00:00
David Majnemer a94e7b6acf [Sema] Handle leading and trailing __ for GNU attributes
GNU attributes can have a leading and trailing __ appended/prepended to
the attribute name.  While the parser and AttributeList::getKind did the
right thing, AttributeList::getAttributeSpellingListIndex did not.

This fixes PR24565.

llvm-svn: 245953
2015-08-25 16:44:38 +00:00
Gabor Horvath 03dc473385 [Static Analyzer] Fix tests to reflect the change in the diagnostic message.
llvm-svn: 245951
2015-08-25 16:38:05 +00:00
Gabor Horvath 3240cd3421 [Static Analyzer] Fixed a typo in a diagnostic message.
llvm-svn: 245949
2015-08-25 16:27:03 +00:00