]> granicus.if.org Git - clang/log
clang
6 years ago[MS][ARM64]: Promote _setjmp to_setjmpex as there is no _setjmp in the ARM64 libvcrun...
Reid Kleckner [Wed, 6 Jun 2018 18:39:47 +0000 (18:39 +0000)]
[MS][ARM64]: Promote _setjmp to_setjmpex as there is no _setjmp in the ARM64 libvcruntime.lib

Factor out the common setjmp call emission code.

Based on a patch by Chris January

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334112 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CUDA] Replace 'nv_weak' attributes in CUDA headers with 'weak'.
Artem Belevich [Wed, 6 Jun 2018 17:52:55 +0000 (17:52 +0000)]
[CUDA] Replace 'nv_weak' attributes in CUDA headers with 'weak'.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334108 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoPR37680: fix faulty assertion condition.
Richard Smith [Wed, 6 Jun 2018 16:36:56 +0000 (16:36 +0000)]
PR37680: fix faulty assertion condition.

When looking up a template name, we can find an overload set containing a
function template and an unresolved non-type using declaration.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334106 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Driver] Add flag "--dependent-lib=..." when enabling asan or ubsan on PS4.
Pierre Gousseau [Wed, 6 Jun 2018 14:04:15 +0000 (14:04 +0000)]
[Driver] Add flag "--dependent-lib=..." when enabling asan or ubsan on PS4.

NFC for targets other than PS4.

Simplify users' workflow when enabling asan or ubsan and calling the linker separately.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334096 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoChange test to output 'pcm' to the temp dir, not the source dir
Ilya Biryukov [Wed, 6 Jun 2018 08:50:12 +0000 (08:50 +0000)]
Change test to output 'pcm' to the temp dir, not the source dir

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334073 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix build - use llvm::make_unique
Ivan Donchevskii [Wed, 6 Jun 2018 08:25:54 +0000 (08:25 +0000)]
Fix build - use llvm::make_unique

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334072 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Frontend] Honor UserFilesAreVolatile flag getting file buffer in ASTUnit
Ivan Donchevskii [Wed, 6 Jun 2018 07:17:26 +0000 (07:17 +0000)]
[Frontend] Honor UserFilesAreVolatile flag getting file buffer in ASTUnit

Do not memory map the main file if the flag UserFilesAreVolatile is set to true
in ASTUnit when calling FileSystem::getBufferForFile.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334070 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Analyzer][Z3] Test fixes for Z3 constraint manager
Vlad Tsyrklevich [Wed, 6 Jun 2018 06:25:51 +0000 (06:25 +0000)]
[Analyzer][Z3] Test fixes for Z3 constraint manager

Summary:
Since Z3 tests have been not been running [1] some tests needed to be
updated. I also added a regression test for [1].

[1] https://reviews.llvm.org/D47722

Reviewers: george.karpenkov, NoQ, ddcc

Reviewed By: george.karpenkov

Subscribers: mikhail.ramalho, dcoughlin, xazax.hun, szepet, zzheng, a.sidorin, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334067 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Analyzer] Fix Z3ConstraintManager crash (PR37646)
Vlad Tsyrklevich [Wed, 6 Jun 2018 06:09:02 +0000 (06:09 +0000)]
[Analyzer] Fix Z3ConstraintManager crash (PR37646)

Summary:
Fix another Z3ConstraintManager crash, use fixAPSInt() to extend a
boolean APSInt.

Reviewers: george.karpenkov, NoQ, ddcc

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334065 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Fuchsia] Include install-distribution-stripped in bootstrap targets
Petr Hosek [Wed, 6 Jun 2018 05:18:39 +0000 (05:18 +0000)]
[Fuchsia] Include install-distribution-stripped in bootstrap targets

This enables the use of install-distribution-stripped target in the
2-stage builds.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334063 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Sema] Fix parsing of anonymous union in language linkage specification
Jan Korous [Wed, 6 Jun 2018 05:16:34 +0000 (05:16 +0000)]
[Sema] Fix parsing of anonymous union in language linkage specification

C++17 [dcl.link]p4:
A linkage specification does not establish a scope.

C++17 [class.union.anon]p2:
Namespace level anonymous unions shall be declared static.

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

rdar://problem/37545925

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334062 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Move the vec_set/vec_ext builtins for 64-bit elements to BuiltinsX86_64.def.
Craig Topper [Wed, 6 Jun 2018 04:51:52 +0000 (04:51 +0000)]
[X86] Move the vec_set/vec_ext builtins for 64-bit elements to BuiltinsX86_64.def.

The instructions these correspond to and the intrinsics that use them are only available in 64-bit mode.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334061 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix std::tuple errors
Reid Kleckner [Wed, 6 Jun 2018 01:44:10 +0000 (01:44 +0000)]
Fix std::tuple errors

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334060 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoImplement bittest intrinsics generically for non-x86 platforms
Reid Kleckner [Wed, 6 Jun 2018 01:35:08 +0000 (01:35 +0000)]
Implement bittest intrinsics generically for non-x86 platforms

I tested these locally on an x86 machine by disabling the inline asm
codepath and confirming that it does the same bitflips as we do with the
inline asm.

Addresses code review feedback.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334059 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Add builtins for vector element insert and extract for different 128 and 256...
Craig Topper [Wed, 6 Jun 2018 00:24:55 +0000 (00:24 +0000)]
[X86] Add builtins for vector element insert and extract for different 128 and 256 bit vector types. Use them to implement the extract and insert intrinsics.

Previously we were just using extended vector operations in the header file.

This unfortunately allowed non-constant indices to be used with the intrinsics. This is incompatible with gcc, icc, and MSVC. It also introduces a different performance characteristic because non-constant index gets lowered to a vector store and an element sized load.

By adding the builtins we can check for the index to be a constant and ensure its in range of the vector element count.

User code still has the option to use extended vector operations themselves if they need non-constant indexing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334057 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Implement __builtin_ia32_vec_ext_v2si correctly even though we only use it...
Craig Topper [Tue, 5 Jun 2018 22:40:03 +0000 (22:40 +0000)]
[X86] Implement __builtin_ia32_vec_ext_v2si correctly even though we only use it with an index of 0.

This builtin takes an index as its second operand, but the codegen hardcodes an index of 0 and doesn't use the operand. The only use of the builtin in the header file passes 0 to the operand so this works for that usage. But its more correct to use the real operand.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334054 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Make __builtin_ia32_vec_ext_v2si require ICE for its index argument. Add warnin...
Craig Topper [Tue, 5 Jun 2018 21:54:35 +0000 (21:54 +0000)]
[X86] Make __builtin_ia32_vec_ext_v2si require ICE for its index argument. Add warnings for out of range indices for __builtin_ia32_vec_ext_v2si, __builtin_ia32_vec_ext_v4hi, and __builtin_ia32_vec_set_v4hi.

These should take a constant value for an index and that constant should be a valid element number.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334051 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CUDA][HIP] Do not emit type info when compiling for device
Yaxun Liu [Tue, 5 Jun 2018 15:11:02 +0000 (15:11 +0000)]
[CUDA][HIP] Do not emit type info when compiling for device

CUDA/HIP does not support RTTI on device side, therefore there
is no point of emitting type info when compiling for device.

Emitting type info for device not only clutters the IR with useless
global variables, but also causes undefined symbol at linking
since vtable for cxxabiv1::class_type_info has external linkage.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334021 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoDetect an incompatible VLA pointer assignment
Jeremy Morse [Tue, 5 Jun 2018 09:18:26 +0000 (09:18 +0000)]
Detect an incompatible VLA pointer assignment

For pointer assignments of VLA types, Clang currently detects when array
dimensions _lower_ than a variable dimension differ, and reports a warning.
However it does not do the same when the _higher_ dimensions differ, a
case that GCC does catch.

These two pointer types

    int (*foo)[1][bar][3];
    int (*baz)[1][2][3];

are compatible with each another, and the program is well formed if
bar == 2, a matter that is the programmers problem. However the following:

    int (*qux)[2][2][3];

would not be compatible with either, because the upper dimension differs
in size. Clang reports baz is incompatible with qux, but not that foo is
incompatible with qux because it doesn't check those higher dimensions.

Fix this by comparing array sizes on higher dimensions: if both are
constants but unequal then report incompatibility; if either dimension is
variable then we can't know either way.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333989 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Mark all the builtins and intrinsics that require MMX and an SSE feature as...
Craig Topper [Tue, 5 Jun 2018 03:12:14 +0000 (03:12 +0000)]
[X86] Mark all the builtins and intrinsics that require MMX and an SSE feature as requiring both mmx and the sse feature.

Previously we only checked the sse feature, but this means that if you passed -mno-mmx, the builtins/intrinsics wouldn't be disabled in the frontend and would instead fail backend isel.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333980 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Driver][Fuchsia] Pass LTO flags to linker
Petr Hosek [Tue, 5 Jun 2018 01:50:59 +0000 (01:50 +0000)]
[Driver][Fuchsia] Pass LTO flags to linker

Even though we use lld by default for Fuchsia, we use Gold plugin
arguments like all other drivers as lld supports Gold plugin options.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333979 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoReimplement the bittest intrinsic family as builtins with inline asm
Reid Kleckner [Tue, 5 Jun 2018 01:33:40 +0000 (01:33 +0000)]
Reimplement the bittest intrinsic family as builtins with inline asm

We need to implement _interlockedbittestandset as a builtin for
windows.h, so we might as well do the whole family. It reduces code
duplication anyway.

Fixes PR33188, a long standing bug in our bittest implementation
encountered by Chakra.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333978 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[clang-proto-fuzzer] Refactored LLVMFuzzerInitialize into its own file.
Matt Morehouse [Tue, 5 Jun 2018 00:11:41 +0000 (00:11 +0000)]
[clang-proto-fuzzer] Refactored LLVMFuzzerInitialize into its own file.

Copied and renamed some files in preparation for new loop-proto-fuzzer.

Patch By: emmettneyman

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333969 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[ThinLTO] Add testing of new summary index format to a couple CFI tests
Teresa Johnson [Mon, 4 Jun 2018 23:05:24 +0000 (23:05 +0000)]
[ThinLTO] Add testing of new summary index format to a couple CFI tests

Summary:
Adds testing of combined index summary entries in disassembly format
to CFI tests that were already testing the bitcode format.

Depends on D46699.

Reviewers: pcc

Subscribers: mehdi_amini, inglorion, eraman, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333966 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert r333791 "Cap "voluntary" vector alignment at 16 for all Darwin platforms."
Reid Kleckner [Mon, 4 Jun 2018 21:39:20 +0000 (21:39 +0000)]
Revert r333791 "Cap "voluntary" vector alignment at 16 for all Darwin platforms."

Adding __attribute__((aligned(32))) to __m256 breaks the implementation
of _mm256_loadu_ps on Windows. On Windows, alignment attributes have
higher precedence than packing attributes.

We also might want to carefully consider the consequences of changing
our vector typedefs, since many users copy them and invent their own
new, non-Intel specific vector type names.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333958 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoUpdate for an LLVM header file move
David Blaikie [Mon, 4 Jun 2018 21:23:29 +0000 (21:23 +0000)]
Update for an LLVM header file move

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333955 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Re-enable constructors when lifetime extension through fields occurs.
Artem Dergachev [Mon, 4 Jun 2018 20:18:37 +0000 (20:18 +0000)]
[analyzer] Re-enable constructors when lifetime extension through fields occurs.

Temporary object constructor inlining was disabled in r326240 for code like

    const int &x = A().x;

because automatic destructor for the lifetime-extended object A() was not
working correctly in CFG.

CFG was fixed in r333941, so inlining can be re-enabled. CFG for lifetime
extension through aggregates still needs to be fixed.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333946 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Avoid passing _mm_undefined* to builtin_shufflevector if we are able to pass...
Craig Topper [Mon, 4 Jun 2018 19:28:09 +0000 (19:28 +0000)]
[X86] Avoid passing _mm_undefined* to builtin_shufflevector if we are able to pass the first input a second time.

This is more consistent with other usages of builtin_shufflevector. Later optimization passes or codegen will detect the duplicate vector and replace it with undef. Using _mm_undefined just puts a zeroinitializer that still needs to be optimized out later.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333944 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CFG] Fix automatic destructors when a member is bound to a reference.
Artem Dergachev [Mon, 4 Jun 2018 18:56:25 +0000 (18:56 +0000)]
[CFG] Fix automatic destructors when a member is bound to a reference.

In code like

    const int &x = A().x;

automatic destructor for the object A() lifetime-extended by reference 'x' was
not present in the clang CFG due to ad-hoc pattern-matching in
getReferenceInitTemporaryType().

Re-use skipRValueSubobjectAdjustments() again to find the lifetime-extended
object in the AST and emit the correct destructor.

Lifetime extension through aggregates with references still needs to be covered.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333941 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRemove llvm::Triple argument from get***Personality() functions. NFC.
Heejin Ahn [Mon, 4 Jun 2018 18:23:00 +0000 (18:23 +0000)]
Remove llvm::Triple argument from get***Personality() functions. NFC.

Summary:
Because `llvm::Triple` can be derived from `TargetInfo`, it is simpler
to take only `TargetInfo` argument.

Reviewers: sbc100

Subscribers: cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333938 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoThis diff includes changes for supporting the following types.
Leonard Chan [Mon, 4 Jun 2018 16:07:52 +0000 (16:07 +0000)]
This diff includes changes for supporting the following types.

// Primary fixed point types
signed short _Accum s_short_accum;
signed _Accum s_accum;
signed long _Accum s_long_accum;
unsigned short _Accum u_short_accum;
unsigned _Accum u_accum;
unsigned long _Accum u_long_accum;

// Aliased fixed point types
short _Accum short_accum;
_Accum accum;
long _Accum long_accum;
This diff only allows for declaration of the fixed point types. Assignment and other operations done on fixed point types according to http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf will be added in future patches. The saturated versions of these types and the equivalent _Fract types will also be added in future patches.

The tests included are for asserting that we can declare these types.

Fixed the test that was failing by not checking for dso_local on some
targets.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333923 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] False positive refutation with Z3
Mikhail R. Gadelha [Mon, 4 Jun 2018 14:40:44 +0000 (14:40 +0000)]
[analyzer] False positive refutation with Z3

Summary: This is a prototype of a bug reporter visitor that invalidates bug reports by re-checking constraints of certain states on the bug path using the Z3 constraint manager backend. The functionality is available under the `crosscheck-with-z3` analyzer config flag.

Reviewers: george.karpenkov, NoQ, dcoughlin, rnkovacs

Reviewed By: george.karpenkov

Subscribers: rnkovacs, NoQ, george.karpenkov, dcoughlin, xbolva00, ddcc, mikhail.ramalho, MTC, fhahn, whisperity, baloghadamsoftware, szepet, a.sidorin, gsd, dkrupp, xazax.hun, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333903 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago Created a tiny SMT interface and make Z3ConstraintManager implement it
Mikhail R. Gadelha [Mon, 4 Jun 2018 14:25:58 +0000 (14:25 +0000)]
 Created a tiny SMT interface and make Z3ConstraintManager implement it

Summary:
This patch implements a simple SMTConstraintManager API, and requires the implementation of two methods for now: `addRangeConstraints` and `isModelFeasible`.

Update Z3ConstraintManager to inherit it and implement required methods.

I also moved the method to dump the SMT formula from D45517 to this patch.

This patch was created based on the reviews from D47640.

Reviewers: george.karpenkov, NoQ, ddcc, dcoughlin

Reviewed By: george.karpenkov

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333899 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[clang][tooling] Don't forget to link to clangToolingInclusions.
Roman Lebedev [Mon, 4 Jun 2018 12:04:41 +0000 (12:04 +0000)]
[clang][tooling] Don't forget to link to clangToolingInclusions.

Fixes build with shared libs, broken by rL333874.
Some buildbot converage is sorely missing.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333890 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoReland "Move #include manipulation code to new lib/Tooling/Inclusions."
Eric Liu [Mon, 4 Jun 2018 09:04:12 +0000 (09:04 +0000)]
Reland "Move #include manipulation code to new lib/Tooling/Inclusions."

This reverts commit r333534 (i.e. reland r332720) after fixing module build.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333874 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Fix a couple places that were using macro arguments twice when of the usages...
Craig Topper [Mon, 4 Jun 2018 02:56:18 +0000 (02:56 +0000)]
[X86] Fix a couple places that were using macro arguments twice when of the usages could just be undefined.

One of the arguments was being used when the passthru argument is unused due to the mask being all 1s. But in that case the actual value doesn't matter so we should use undef instead to avoid expanding the macro argument unnecessarily.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333865 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoMoved RangedConstraintManager header to the StaticAnalyser include dir
Mikhail R. Gadelha [Mon, 4 Jun 2018 00:23:01 +0000 (00:23 +0000)]
Moved RangedConstraintManager header to the StaticAnalyser include dir

Summary:
Moved `RangedConstraintManager` header from  `lib/StaticAnalyzer/Core/` to `clang/StaticAnalyzer/Core/PathSensitive/`. No changes to the code.

Reviewers: NoQ, george.karpenkov, dcoughlin

Reviewed By: george.karpenkov

Subscribers: NoQ, george.karpenkov, dcoughlin, ddcc

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333862 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Remove superfluous escaped new lines from intrinsic files.
Craig Topper [Sun, 3 Jun 2018 23:31:01 +0000 (23:31 +0000)]
[X86] Remove superfluous escaped new lines from intrinsic files.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333858 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Explicitly make the arguments to __slwpcb intrinsic 'void'.
Craig Topper [Sun, 3 Jun 2018 22:05:19 +0000 (22:05 +0000)]
[X86] Explicitly make the arguments to __slwpcb intrinsic 'void'.

This is the correct way to say it takes no arguments in C.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333855 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Replace __builtin_ia32_vbroadcastf128_pd256 and __builtin_ia32_vbroadcastf128_p...
Craig Topper [Sun, 3 Jun 2018 19:42:59 +0000 (19:42 +0000)]
[X86] Replace __builtin_ia32_vbroadcastf128_pd256 and __builtin_ia32_vbroadcastf128_ps256 with an unaligned load intrinsics and a __builtin_shufflevector call.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333853 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Pass ArrayRef instead of SmallVectorImpl& to the X86 builtin helper functions...
Craig Topper [Sun, 3 Jun 2018 19:02:57 +0000 (19:02 +0000)]
[X86] Pass ArrayRef instead of SmallVectorImpl& to the X86 builtin helper functions. NFC

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333851 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert r333848 "[X86] Pass ArrayRef instead of SmallVectorImpl& to the X86 builtin...
Craig Topper [Sun, 3 Jun 2018 18:41:22 +0000 (18:41 +0000)]
Revert r333848 "[X86] Pass ArrayRef instead of SmallVectorImpl& to the X86 builtin helper functions. NFC"

Looks like I missed some changes to make this work.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333850 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Pass ArrayRef instead of SmallVectorImpl& to the X86 builtin helper functions...
Craig Topper [Sun, 3 Jun 2018 18:08:37 +0000 (18:08 +0000)]
[X86] Pass ArrayRef instead of SmallVectorImpl& to the X86 builtin helper functions. NFC

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333848 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] When emitting masked loads/stores don't check for all ones mask.
Craig Topper [Sun, 3 Jun 2018 18:08:36 +0000 (18:08 +0000)]
[X86] When emitting masked loads/stores don't check for all ones mask.

This seems like a premature optimization. It's unlikely a user would pass something the frontend can tell is all ones to the masked load/store intrinsics.

We do this optimization for emitting select for masking because we have builtin calls in header files that pass an all ones mask in. Though at this point we may not longer have any builtins that emit some IR and a select. We may only have the select builtins so maybe we can remove that optimization too.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333847 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Mark the pointer arguments to expandload builtins as const consistently.
Craig Topper [Sun, 3 Jun 2018 18:08:34 +0000 (18:08 +0000)]
[X86] Mark the pointer arguments to expandload builtins as const consistently.

Some of them had it and some didn't. This should make them consistent.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333846 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoclang-interpreter: Add missing LLVM component Object
Fangrui Song [Sun, 3 Jun 2018 08:12:15 +0000 (08:12 +0000)]
clang-interpreter: Add missing LLVM component Object

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333836 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[NEON] Support VLD1xN intrinsics in AArch32 mode (Clang part)
Ivan A. Kosarev [Sat, 2 Jun 2018 17:42:59 +0000 (17:42 +0000)]
[NEON] Support VLD1xN intrinsics in AArch32 mode (Clang part)

We currently support them only in AArch64. The NEON Reference,
however, says they are 'ARMv7, ARMv8' intrinsics.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333829 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "This diff includes changes for supporting the following types."
Leonard Chan [Sat, 2 Jun 2018 03:27:13 +0000 (03:27 +0000)]
Revert "This diff includes changes for supporting the following types."

This reverts commit r333814, which fails for a test checking the bit
width on ubuntu.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333815 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoThis diff includes changes for supporting the following types.
Leonard Chan [Sat, 2 Jun 2018 02:58:51 +0000 (02:58 +0000)]
This diff includes changes for supporting the following types.

```

// Primary fixed point types
signed short _Accum s_short_accum;
signed _Accum s_accum;
signed long _Accum s_long_accum;
unsigned short _Accum u_short_accum;
unsigned _Accum u_accum;
unsigned long _Accum u_long_accum;

// Aliased fixed point types
short _Accum short_accum;
_Accum accum;
long _Accum long_accum;

```

This diff only allows for declaration of the fixed point types. Assignment and other operations done on fixed point types according to http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1169.pdf will be added in future patches. The saturated versions of these types and the equivalent `_Fract` types will also be added in future patches.

The tests included are for asserting that we can declare these types.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333814 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[cmake] Support LLD for CLANG_ORDER_FILE
Shoaib Meenai [Sat, 2 Jun 2018 01:22:39 +0000 (01:22 +0000)]
[cmake] Support LLD for CLANG_ORDER_FILE

LLD also supports order files using the `--symbol-ordering-file` option.
As the name would suggest, the order file format is slightly different
from gold; gold's order files specify section names, whereas LLD's
specify symbol names. Assuming you have an order file in the correct
format though, we should support using it with LLD.

Switch the check to actually use LLVM's linker detection rather than
just checking for the presence of the gold executable, since we might
have a gold executable present but be using LLD (or bfd for that matter)
as our linker.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333810 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[cmake] Use LLVM's check_linker_flag
Shoaib Meenai [Sat, 2 Jun 2018 00:49:54 +0000 (00:49 +0000)]
[cmake] Use LLVM's check_linker_flag

LLVM already defines this function, so make use of it instead of rolling
our own.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333808 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd Features.def to module map
Eric Fiselier [Fri, 1 Jun 2018 22:51:59 +0000 (22:51 +0000)]
Add Features.def to module map

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333802 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoCap "voluntary" vector alignment at 16 for all Darwin platforms.
John McCall [Fri, 1 Jun 2018 21:34:26 +0000 (21:34 +0000)]
Cap "voluntary" vector alignment at 16 for all Darwin platforms.

This fixes two major problems:
- We were not capping vector alignment as desired on 32-bit ARM.
- We were using different alignments based on the AVX settings on
  Intel, so we did not have a consistent ABI.

This is an ABI break, but we think we can get away with it because
vectors tend to be used mostly in inline code (which is why not having
a consistent ABI has not proven disastrous on Intel).

Intel's AVX types are specified as having 32-byte / 64-byte alignment,
so align them explicitly instead of relying on the base ABI rule.
Note that this sort of attribute is stripped from template arguments
in template substitution, so there's a possibility that code templated
over vectors will produce inadequately-aligned objects.  The right
long-term solution for this is for alignment attributes to be
interpreted as true qualifiers and thus preserved in the canonical type.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333791 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Rewrite avx512vbmi unmasked and maskz macro intrinsics to be wrappers around...
Craig Topper [Fri, 1 Jun 2018 18:26:35 +0000 (18:26 +0000)]
[X86] Rewrite avx512vbmi unmasked and maskz macro intrinsics to be wrappers around their __builtin function with appropriate arguments rather than just passing arguments to the masked intrinsic.

This is more consistent with all of our other avx512 macro intrinsics.

It also fixes a bad cast where an argument was casted to mmask8 when it should have been a mmask16.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333778 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Coverage] Remove a test dependency on the itanium ABI
Vedant Kumar [Fri, 1 Jun 2018 17:11:18 +0000 (17:11 +0000)]
[Coverage] Remove a test dependency on the itanium ABI

This should address a bot failure:
http://lab.llvm.org:8011/builders/llvm-clang-x86_64-expensive-checks-win/builds/9994/

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333775 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRemove redundant -fno-coverage-mapping added in r333761 (already added in r333423)
Nico Weber [Fri, 1 Jun 2018 15:02:43 +0000 (15:02 +0000)]
Remove redundant -fno-coverage-mapping added in r333761 (already added in r333423)

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333762 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoclang-cl: Expose -no-canonical-prefixes
Nico Weber [Fri, 1 Jun 2018 14:59:57 +0000 (14:59 +0000)]
clang-cl: Expose -no-canonical-prefixes

-no-canonical-prefixes is a weird flag: In gcc, it controls whether realpath()
is called on the path of the driver binary. It's needed to support some
usecases where gcc is symlinked to, see
https://gcc.gnu.org/ml/gcc/2011-01/msg00429.html for some background.

In clang, the resource dir is found relative to the compiler binary, and
without -no-canonical-prefixes that's an absolute path. For clang, the main use
case for -no-canonical-prefixes is to make the -resource-dir path added by the
driver relative instead of absolute. Making it relative seems like the better
default, but since neither clang not gcc have -canonical-prefixes without no-
which makes changing the default tricky, and since some symlink behaviors do
depend on the realpath() call at least for gcc, just expose
-no-canonical-prefixes in clang-cl mode.

Alternatively we could default to no-canonical-prefix-mode for clang-cl since
it's less likely to be used in symlinked scenarios, but since you already need
to about -no-canonical-prefixes for the non-clang-cl bits of your build, not
hooking this of driver mode seems better to me.

https://reviews.llvm.org/D47480

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333761 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[OpenMP] Fix typo in NVPTX linker, NFC.
Jonas Hahnfeld [Fri, 1 Jun 2018 14:43:48 +0000 (14:43 +0000)]
[OpenMP] Fix typo in NVPTX linker, NFC.

Clang calls "nvlink" for linking multiple object files with OpenMP
target functions, so correct this information when printing errors.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333757 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix unused variable warning from r333718
Erich Keane [Fri, 1 Jun 2018 14:16:18 +0000 (14:16 +0000)]
Fix unused variable warning from r333718

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333752 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[OpenCL, OpenMP] Fix crash when OpenMP used in OpenCL file
Erich Keane [Fri, 1 Jun 2018 13:04:26 +0000 (13:04 +0000)]
[OpenCL, OpenMP] Fix crash when OpenMP used in OpenCL file

Compiler crashes when omp simd is used in an OpenCL file:

clang -c -fopenmp omp_simd.cl

__kernel void test(global int *data, int size) {
#pragma omp simd
  for (int i = 0; i < size; ++i) {
  }
}

The problem seems to be the check added to verify block pointers have
initializers. An OMPCapturedExprDecl is created to capture â€˜size’ but there is
no TypeSourceInfo.

The change just uses getType() directly.

Patch-By: mikerice
Differential Revision: https://reviews.llvm.org/D46667

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333746 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[CodeComplete] Add a few extra tests for r333538. NFC
Ilya Biryukov [Fri, 1 Jun 2018 09:49:53 +0000 (09:49 +0000)]
[CodeComplete] Add a few extra tests for r333538. NFC

From a follow-up discussion in D44480.
New tests check that function bodies are not skipped:
- In presence of ptr declarators, e.g. `auto**`.
- When `decltype(auto)` is used in return type, only `auto` was checked before.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333735 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Remove leftover semicolons at end of macros
Martin Storsjo [Fri, 1 Jun 2018 09:40:50 +0000 (09:40 +0000)]
[X86] Remove leftover semicolons at end of macros

This was missed in a few places in SVN r333613, causing compilation
errors if these macros are used e.g. as parameter to a function.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333734 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] NFC: Track all constructed objects in a single state trait.
Artem Dergachev [Fri, 1 Jun 2018 01:59:48 +0000 (01:59 +0000)]
[analyzer] NFC: Track all constructed objects in a single state trait.

ExprEngine already maintains three internal program state traits to track
path-sensitive information related to object construction: pointer returned by
operator new, and pointer to temporary object for two different purposes - for
destruction and for lifetime extension. We'll need to add 2-3 more in a few
follow-up commits.

Merge these traits into one because they all essentially serve one purpose and
work similarly.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333719 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Modules] Warning for module declarations lacking 'framework' qualifier
Bruno Cardoso Lopes [Fri, 1 Jun 2018 01:26:18 +0000 (01:26 +0000)]
[Modules] Warning for module declarations lacking 'framework' qualifier

When a module declaration for a framework lacks the 'framework'
qualifier, the listed headers aren't found (because there's no
trigger for the special framework style path lookup) and the module
is silently not built. This leads to frameworks not being modularized
by accident, which is pretty bad.

Add a warning and suggest the user to add the 'framework' qualifier
when we can prove that it's the case.

rdar://problem/39193062

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333718 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Hide new Wasm EH behind its feature flag
Heejin Ahn [Fri, 1 Jun 2018 01:01:37 +0000 (01:01 +0000)]
[WebAssembly] Hide new Wasm EH behind its feature flag

Summary:
clang's current wasm EH implementation is a non-MVP feature in progress.
We had a `-mexception-handling` wasm feature but were not using it. This
patch hides the non-MVP wasm EH behind a flag, so it does not affect
other code for now.

Reviewers: dschuff

Subscribers: sbc100, jgravelle-google, sunfish, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333716 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Coverage] End deferred regions before labels, fixes PR35867
Vedant Kumar [Fri, 1 Jun 2018 00:37:13 +0000 (00:37 +0000)]
[Coverage] End deferred regions before labels, fixes PR35867

A deferred region should end before the start of a label, and should not
extend to the start of the label sub-statement.

Fixes llvm.org/PR35867.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333715 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Update to the new names for the memory builtin functions.
Dan Gohman [Fri, 1 Jun 2018 00:05:51 +0000 (00:05 +0000)]
[WebAssembly] Update to the new names for the memory builtin functions.

The WebAssembly committee has decided on the names `memory.size` and
`memory.grow` for the memory intrinsics, so update the clang builtin
functions to follow those names, keeping both sets of old names in place
for compatibility.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333712 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] fix bug with 1-bit APSInt types in Z3ConstraintManager
Dominic Chen [Thu, 31 May 2018 22:23:07 +0000 (22:23 +0000)]
[analyzer] fix bug with 1-bit APSInt types in Z3ConstraintManager

Summary: Clang does not have a corresponding QualType for a 1-bit APSInt, so use the BoolTy and extend the APSInt. Split from D35450. Fixes PR37622.

Reviewers: george.karpenkov, NoQ

Subscribers: mikhail.ramalho, xazax.hun, szepet, rnkovacs, cfe-commits, a.sidorin

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333704 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[WebAssembly] Use Windows EH instructions for Wasm EH
Heejin Ahn [Thu, 31 May 2018 22:18:13 +0000 (22:18 +0000)]
[WebAssembly] Use Windows EH instructions for Wasm EH

Summary:
Because wasm control flow needs to be structured, using WinEH
instructions to support wasm EH brings several benefits. This patch
makes wasm EH uses Windows EH instructions, with some changes:
1. Because wasm uses a single catch block to catch all C++ exceptions,
   this merges all catch clauses into a single catchpad, within which we
   test the EH selector as in Itanium EH.
2. Generates a call to `__clang_call_terminate` in case a cleanup
   throws. Wasm does not have a runtime to handle this.
3. In case there is no catch-all clause, inserts a call to
   `__cxa_rethrow` at the end of a catchpad in order to unwind to an
   enclosing EH scope.

Reviewers: majnemer, dschuff

Subscribers: jfb, sbc100, jgravelle-google, sunfish, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333703 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoFix null MSInheritanceAttr deref in CXXRecordDecl::getMSInheritanceModel()
Reid Kleckner [Thu, 31 May 2018 18:42:29 +0000 (18:42 +0000)]
Fix null MSInheritanceAttr deref in CXXRecordDecl::getMSInheritanceModel()

Ensure latest MPT decl has a MSInheritanceAttr when instantiating
templates, to avoid null MSInheritanceAttr deref in
CXXRecordDecl::getMSInheritanceModel().

See PR#37399 for repo / details.

Patch by Andrew Rogers!

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333680 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Annotate ProgramState update methods with LLVM_NODISCARD.
Artem Dergachev [Thu, 31 May 2018 18:30:41 +0000 (18:30 +0000)]
[analyzer] Annotate ProgramState update methods with LLVM_NODISCARD.

Because our program states are immutable, methods like "add<>", "set<>", "bind"
create a copy of the program state instead of mutating the existing state.
If the updated state is discarded, it clearly indicates a bug.
Such bugs are introduced frequently, hence the warn_unused_result annotation.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333679 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoIRGen: Write .dwo files when -split-dwarf-file is used together with -fthinlto-index.
Peter Collingbourne [Thu, 31 May 2018 18:25:59 +0000 (18:25 +0000)]
IRGen: Write .dwo files when -split-dwarf-file is used together with -fthinlto-index.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333677 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Improve performance of the SVal simplification mechanism further.
Artem Dergachev [Thu, 31 May 2018 17:27:28 +0000 (17:27 +0000)]
[analyzer] Improve performance of the SVal simplification mechanism further.

Memoize simplification so that we didn't need to simplify the same symbolic
expression twice within the same program state.

Gives ~25% performance boost on the artificial test in test/Analysis/hangs.c.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333671 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Improve performance of the SVal simplification mechanism.
Artem Dergachev [Thu, 31 May 2018 17:22:38 +0000 (17:22 +0000)]
[analyzer] Improve performance of the SVal simplification mechanism.

When neither LHS nor RHS of a binary operator expression can be simplified,
return the original expression instead of re-evaluating the binary operator.

Such re-evaluation was causing recusrive re-simplification which caused
the algorithmic complexity to explode.

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333670 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd dump method for selectors
Aditya Kumar [Thu, 31 May 2018 14:45:32 +0000 (14:45 +0000)]
Add dump method for selectors

Differential Revision: https://reviews.llvm.org/D45935
Reviewers: compnerd

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333657 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd a new driver mode to dump compiler feature and extension options.
Aaron Ballman [Thu, 31 May 2018 13:57:09 +0000 (13:57 +0000)]
Add a new driver mode to dump compiler feature and extension options.

Add the ability to dump compiler option-related information to a JSON file via the -compiler-options-dump option. Specifically, it dumps the features/extensions lists -- however, this output could be extended to other information should it be useful. In order to support features and extensions, I moved them into a .def file so that we could build the various lists we care about from them without a significant increase in maintenance burden.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333653 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Driver] Clean up tmp files when deleting Compilation objects
David Stenberg [Thu, 31 May 2018 09:05:22 +0000 (09:05 +0000)]
[Driver] Clean up tmp files when deleting Compilation objects

Summary:
In rL327851 the createUniqueFile() and createTemporaryFile()
variants that do not return the file descriptors were changed to
create empty files, rather than only check if the paths are free.
This change was done in order to make the functions race-free.

That change led to clang-tidy (and possibly other tools) leaving
behind temporary assembly files, of the form placeholder-*, when
using a target that does not support the internal assembler.

The temporary files are created when building the Compilation
object in stripPositionalArgs(), as a part of creating the
compilation database for the arguments after the double-dash. The
files are created by Driver::GetNamedOutputPath().

Fix this issue by cleaning out temporary files at the deletion of
Compilation objects.

This fixes https://bugs.llvm.org/show_bug.cgi?id=37091.

Reviewers: klimek, sepavloff, arphaman, aaron.ballman, john.brawn, mehdi_amini, sammccall, bkramer, alexfh, JDevlieghere

Reviewed By: aaron.ballman, JDevlieghere

Subscribers: erichkeane, lebedev.ri, Ka-Ka, cfe-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333637 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Make 512-bit unmasked load/store builtins more like their 128/256-bit equivalents.
Craig Topper [Thu, 31 May 2018 05:02:08 +0000 (05:02 +0000)]
[X86] Make 512-bit unmasked load/store builtins more like their 128/256-bit equivalents.

Previously we were just passing -1 mask to the masked builtin. This changes it to the more generic way that the 128/256 bit use.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333626 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Fix wrong intrinsic semantic.
Tim Shen [Thu, 31 May 2018 01:51:07 +0000 (01:51 +0000)]
[X86] Fix wrong intrinsic semantic.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333617 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Fix some places where macro arguments to intrinsics weren't cast to _m512(i...
Craig Topper [Thu, 31 May 2018 01:24:40 +0000 (01:24 +0000)]
[X86] Fix some places where macro arguments to intrinsics weren't cast to _m512(i|d)/_m256(i|d/_m128(i|d) first.

The majority of the cases were correct. This fixes the few that weren't.

I also removed some superfluous parentheses in non-macros that confused by attempts at grepping for missing casts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333615 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Remove __extension__ from macro intrinsics when its not needed.
Craig Topper [Thu, 31 May 2018 00:51:20 +0000 (00:51 +0000)]
[X86] Remove __extension__ from macro intrinsics when its not needed.

I think this is a holdover from when we used to declare variables inside the macros. And then its been copy and pasted forward for years every time a new macro intrinsic gets added.

Interestingly this caused some tests for IRGen to be slightly more optimized. We now return a zeroinitializer directly instead of going through a store+load.

It also removed a bogus error message on another test.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333613 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[analyzer] Trust _Nonnull annotations, and trust analyzer knowledge about receiver...
George Karpenkov [Thu, 31 May 2018 00:28:13 +0000 (00:28 +0000)]
[analyzer] Trust _Nonnull annotations, and trust analyzer knowledge about receiver nullability

Previously, the checker was using the nullability of the expression,
which is nonnull IFF both receiver and method are annotated as _Nonnull.
However, the receiver could be known to the analyzer to be nonnull
without being explicitly marked as _Nonnull.

rdar://40635584

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333612 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[Coverage] Discard the last uncompleted deferred region in a decl
Vedant Kumar [Wed, 30 May 2018 23:35:44 +0000 (23:35 +0000)]
[Coverage] Discard the last uncompleted deferred region in a decl

Discard the last uncompleted deferred region in a decl, if one exists.
This prevents lines at the end of a function containing only whitespace
or closing braces from being marked as uncovered, if they follow a
region terminator (return/break/etc).

The previous behavior was to heuristically complete deferred regions at
the end of a decl. In practice this ended up being too brittle for too
little gain. Users would complain that there was no way to reach full
code coverage because whitespace at the end of a function would be
marked uncovered.

rdar://40238228

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333609 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[www] Update C++ status to cover P0620.
Richard Smith [Wed, 30 May 2018 23:30:36 +0000 (23:30 +0000)]
[www] Update C++ status to cover P0620.

While here, mark three-way comparison as in progress and bump "Clang 6" items from yellow to green.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333606 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Use C style comments in intrinsic headers for overall consistency.
Craig Topper [Wed, 30 May 2018 22:33:21 +0000 (22:33 +0000)]
[X86] Use C style comments in intrinsic headers for overall consistency.

Most of the origial comments used C style /* */ comments, but some C++ // comments had snuck in over time.

Still need to convert all the doxygen comments. Which is much harder to do.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333603 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoIRGen: Rename bitsets -> type metadata. NFC.
Peter Collingbourne [Wed, 30 May 2018 22:29:08 +0000 (22:29 +0000)]
IRGen: Rename bitsets -> type metadata. NFC.

"Type metadata" is the term that we've been using for the CFI-related
information on vtables for a while now.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333602 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAST: Remove an unused ctor. NFC.
Peter Collingbourne [Wed, 30 May 2018 22:14:17 +0000 (22:14 +0000)]
AST: Remove an unused ctor. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333600 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoPR37631: verify that a member deduction guide has the same access as its template.
Richard Smith [Wed, 30 May 2018 22:13:43 +0000 (22:13 +0000)]
PR37631: verify that a member deduction guide has the same access as its template.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333599 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAST: Remove an unused function. NFC.
Peter Collingbourne [Wed, 30 May 2018 22:10:07 +0000 (22:10 +0000)]
AST: Remove an unused function. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333598 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAdd fopen to the list of builtins that we check and whitelist.
Eric Christopher [Wed, 30 May 2018 21:11:45 +0000 (21:11 +0000)]
Add fopen to the list of builtins that we check and whitelist.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333594 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Add __extension__ to a bunch of places in our intrinsic headers that fail if...
Craig Topper [Wed, 30 May 2018 21:08:27 +0000 (21:08 +0000)]
[X86] Add __extension__ to a bunch of places in our intrinsic headers that fail if you run it through -pedantic -ansi.

All of these are lines that create a 'compound literal' to concatenate elements together.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333593 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoPR34520: after instantiating a non-templated member deduction guide, don't forget...
Richard Smith [Wed, 30 May 2018 20:24:10 +0000 (20:24 +0000)]
PR34520: after instantiating a non-templated member deduction guide, don't forget to push it into the class scope.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333589 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoAs discussed with SG10, bump version of __cpp_deduction_guides macro to indicate...
Richard Smith [Wed, 30 May 2018 19:54:52 +0000 (19:54 +0000)]
As discussed with SG10, bump version of __cpp_deduction_guides macro to indicate support for P0620R0.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333587 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[AST] Fix loss of enum forward decl from decl context
Joel E. Denny [Wed, 30 May 2018 18:33:53 +0000 (18:33 +0000)]
[AST] Fix loss of enum forward decl from decl context

For example, given:

  enum __attribute__((deprecated)) T *p;

-ast-print produced:

  enum T *p;

The attribute was lost because the enum forward decl was lost.

Another example is the loss of enum forward decls from C++ namespaces
(in MS compatibility mode).

The trouble was that the EnumDecl node was suppressed, as revealed by
-ast-dump.  The suppression of the EnumDecl was intentional in
r116122, but I don't understand why.  The suppression isn't needed for
the test suite to behave.

Reviewed by: rsmith

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333574 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Simplify the implementation of _mm_sqrt_ss, _mm_rcp_ss, and _mm_rsqrt_ss.
Craig Topper [Wed, 30 May 2018 18:27:07 +0000 (18:27 +0000)]
[X86] Simplify the implementation of _mm_sqrt_ss, _mm_rcp_ss, and _mm_rsqrt_ss.

We don't need the insertion back into the original vector at the end. The builtin already understands that.

This is different than _mm_sqrt_sd which takes two arguments and we do need to insert.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333572 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Reduce the number of setzero intrinsics to just the set defined by the Intel...
Craig Topper [Wed, 30 May 2018 18:02:11 +0000 (18:02 +0000)]
[X86] Reduce the number of setzero intrinsics to just the set defined by the Intel Intrinsics Guide.

We had quite a few for different element sizes of integers sometimes with strange target features attached to them.

We only need a single version for each of _m128i, _m256i, and _m512i with the target feature that first introduced those types.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333568 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Remove 'return' from a bunch of intrinsics that return void and use a builtin...
Craig Topper [Wed, 30 May 2018 17:23:45 +0000 (17:23 +0000)]
[X86] Remove 'return' from a bunch of intrinsics that return void and use a builtin that returns void.

Found by running the intrinsic headers through -pedantic -ansi.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333563 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[X86] Lowering FMA intrinsics to native IR (Clang part)
Gabor Buella [Wed, 30 May 2018 15:27:49 +0000 (15:27 +0000)]
[X86] Lowering FMA intrinsics to native IR (Clang part)

This patch replaces all packed (and scalar without rounding
mode) fused intrinsics with fmadd/fmaddsub variations.
Then fmadd/fmaddsub are lowered to native IR.

Patch by tkrupa

Reviewers: craig.topper, sroland, spatel, RKSimon

Reviewed By: craig.topper

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333555 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[clang-format/ObjC] Correctly parse Objective-C methods with 'class' in name
Ben Hamilton [Wed, 30 May 2018 15:21:38 +0000 (15:21 +0000)]
[clang-format/ObjC] Correctly parse Objective-C methods with 'class' in name

Summary:
Please take a close look at this CL. I haven't touched much of
`UnwrappedLineParser` before, so I may have gotten things wrong.

Previously, clang-format would incorrectly format the following:

```
@implementation Foo

- (Class)class {
}

- (void)foo {
}

@end
```

as:

```
@implementation Foo

- (Class)class {
}

    - (void)foo {
}

@end
```

The problem is whenever `UnwrappedLineParser::parseStructuralElement()`
sees any of the keywords `class`, `struct`, or `enum`, it calls
`parseRecord()` to parse them as a C/C++ record.

This causes subsequent lines to be parsed incorrectly, which
causes them to be indented incorrectly.

In Objective-C/Objective-C++, these keywords are valid selector
components.

This diff fixes the issue by explicitly handling `+` and `-` lines
inside `@implementation` / `@interface` / `@protocol` blocks
and parsing them as Objective-C methods.

Test Plan: New tests added. Ran tests with:
  make -j16 FormatTests && ./tools/clang/unittests/Format/FormatTests

Reviewers: jolesiak, klimek

Reviewed By: jolesiak, klimek

Subscribers: klimek, cfe-commits, Wizard

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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333553 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoRevert "Update NRVO logic to support early return"
Sam McCall [Wed, 30 May 2018 14:14:58 +0000 (14:14 +0000)]
Revert "Update NRVO logic to support early return"

This reverts commit r333500, which causes stage2 compiler crashes.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@333547 91177308-0d34-0410-b5e6-96231b3b80d8