]> granicus.if.org Git - clang/log
clang
6 years agoFixed test that failed when checking what variable a value was stored
Leonard Chan [Wed, 20 Jun 2018 18:48:05 +0000 (18:48 +0000)]
Fixed test that failed when checking what variable a value was stored
in for fixed point types.

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

6 years ago[Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals
Leonard Chan [Wed, 20 Jun 2018 17:19:40 +0000 (17:19 +0000)]
[Fixed Point Arithmetic] Fixed Point Precision Bits and Fixed Point Literals

This diff includes the logic for setting the precision bits for each primary fixed point type in the target info and logic for initializing a fixed point literal.

Fixed point literals are declared using the suffixes

```
hr: short _Fract
uhr: unsigned short _Fract
r: _Fract
ur: unsigned _Fract
lr: long _Fract
ulr: unsigned long _Fract
hk: short _Accum
uhk: unsigned short _Accum
k: _Accum
uk: unsigned _Accum
```
Errors are also thrown for illegal literal values

```
unsigned short _Accum u_short_accum = 256.0uhk;   // expected-error{{the integral part of this literal is too large for this unsigned _Accum type}}
```

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

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

6 years agoSimplify. No behavior change.
Nico Weber [Wed, 20 Jun 2018 15:57:38 +0000 (15:57 +0000)]
Simplify. No behavior change.

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

6 years ago[analyzer] Optimize constraint generation when the range is a concrete value
Mikhail R. Gadelha [Wed, 20 Jun 2018 11:42:12 +0000 (11:42 +0000)]
[analyzer] Optimize constraint generation when the range is a concrete value

Summary:
If a constraint is something like:
```
$0 = [1,1]
```
it'll now be created as:
```
assert($0 == 1)
```
instead of:
```
assert($0 >= 1 && $0 <= 1)
```

In general, ~3% speedup when solving per query in my machine. Biggest improvement was when verifying sqlite3, total time went down from 3000s to 2200s.

I couldn't create a test for this as there is no way to dump the formula yet. D48221 adds a method to dump the formula but there is no way to do it from the command line.

Also, a test that prints the formula will most likely fail in the future, as different solvers print the formula in different formats.

Reviewers: NoQ, george.karpenkov, ddcc

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years ago[SPIR] Prevent SPIR targets from using half conversion intrinsics
Sjoerd Meijer [Wed, 20 Jun 2018 09:49:40 +0000 (09:49 +0000)]
[SPIR] Prevent SPIR targets from using half conversion intrinsics

The SPIR target currently allows for half precision floating point types to be
emitted using the LLVM intrinsic functions which convert half types to floats
and doubles. However, this is illegal in SPIR as the only intrinsic allowed by
SPIR is memcpy, as per section 3 of the SPIR specification. Currently this is
leading to an assert being hit in the Clang CodeGen when attempting to emit a
constant or literal _Float16 type in a comparison operation on a SPIR or SPIR64
target. This assert stems from the CodeGen attempting to emit a constant half
value as an integer because the backend has specified that it is using these
half conversion intrinsics (which represents half as i16). This patch prevents
SPIR targets from using these intrinsics by overloading the responsible target
info method, marks SPIR targets as having a legal half type and provides
additional regression testing for the _Float16 type on SPIR targets.

Patch by: Stephen McGroarty

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

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

6 years ago[Sema] Allow creating types with multiple of the same addrspace.
Alexey Bader [Wed, 20 Jun 2018 08:31:24 +0000 (08:31 +0000)]
[Sema] Allow creating types with multiple of the same addrspace.

Summary:
The comment with the OpenCL clause about this clearly
says: "No type shall be qualified by qualifiers for
two or more different address spaces."

This must mean that two or more qualifiers for the
_same_ address space is allowed. However, it is
likely unintended by the programmer, so emit a
warning.

For dependent address space types, reject them like
before since we cannot know what the address space
will be.

Patch by Bevin Hansson (ebevhan).

Reviewers: Anastasia

Reviewed By: Anastasia

Subscribers: bader, cfe-commits

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

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

6 years agoAdd a test to verify the x86 intrinsic headers compile cleanly with no warnings or...
Douglas Yung [Wed, 20 Jun 2018 01:05:09 +0000 (01:05 +0000)]
Add a test to verify the x86 intrinsic headers compile cleanly with no warnings or errors.

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

6 years ago[X86] Undefine _mm512_mask_reduce_operator macro in avx512fintrin.h before redefining it.
Craig Topper [Wed, 20 Jun 2018 00:31:39 +0000 (00:31 +0000)]
[X86] Undefine _mm512_mask_reduce_operator macro in avx512fintrin.h before redefining it.

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

6 years agoAppend new attributes to the end of an AttributeList.
Michael Kruse [Tue, 19 Jun 2018 23:46:52 +0000 (23:46 +0000)]
Append new attributes to the end of an AttributeList.

... instead of prepending it at the beginning (the original behavior
since implemented in r122535 2010-12-23). This builds up an
AttributeList in the the order in which the attributes appear in the
source.

The reverse order caused nodes for attributes in the AST (e.g. LoopHint)
to be in the reverse, and therefore printed in the wrong order by
-ast-dump. Some TODO comments mention this. The order was explicitly
reversed for enable_if attribute overload resolution and name mangling,
which is not necessary anymore with this patch.

The change unfortunately has some secondary effects, especially for
diagnostic output. In the simplest cases, the CHECK lines or expected
diagnostic were changed to the the new output. If the kind of
error/warning changed, the attribute's order was changed instead.

It also causes some 'previous occurrence here' hints to be textually
after the main marker. This typically happens when attributes are
merged, but are incompatible. Interchanging the role of the the main
and note SourceLocation will also cause the case where two different
declaration's attributes (in contrast to multiple attributes of the
same declaration) are merged to be reversed. There is no easy fix
because sometimes previous attributes are merged into a new
declaration's attribute list, sometimes new attributes are added to a
previous declaration's attribute list. Since 'previous occurrence here'
pointing to locations after the main marker is not rare, I left the
markers as-is; it is only relevant when the attributes are declared in
the same declaration anyway, which often is on the same line.

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

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

6 years agoclang-cl: Emit narrowing diag for initializer lists if -fmsc-version is at least...
Nico Weber [Tue, 19 Jun 2018 23:19:34 +0000 (23:19 +0000)]
clang-cl: Emit narrowing diag for initializer lists if -fmsc-version is at least 1900 (i.e. MSVC2015).

Diagnostics for narrowing conversions in initializer lists are currently
DefaultIgnored in Microsoft mode. But MSVC 2015 did add warnings about
narrowing conversions (C2397), so clang-cl can remove its special case code if
MSCompatibilityVersion is new enough.

(In MSVC, C2397 is just a warning and in clang it's default-mapped to an error,
but it can be remapped, and disabled with -Wno-c++11-narrowing, so that should
be fine.)

Fixes PR37314.
https://reviews.llvm.org/D48296

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

6 years agoRecommit r335063: [Darwin] Add a warning for missing include path for libstdc++
Alex Lorenz [Tue, 19 Jun 2018 22:47:53 +0000 (22:47 +0000)]
Recommit r335063: [Darwin] Add a warning for missing include path for libstdc++

The recommit ensures that the tests that failed on bots don't trigger the warning.

Xcode 10 removes support for libstdc++, but the users just get a confusing
include not file warning when including an STL header (when building for iOS6
which uses libstdc++ by default for example).
This patch adds a new warning that lets the user know that the libstdc++ include
path was not found to ensure that the user is more aware of why the error occurs.

rdar://40830462

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

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

6 years agoRecommit r335070 "[X86] Rewrite the max and min reduction intrinsics to make better...
Craig Topper [Tue, 19 Jun 2018 21:00:30 +0000 (21:00 +0000)]
Recommit r335070 "[X86] Rewrite the max and min reduction intrinsics to make better use of other functions and to reduce width to 256 and 128 bits were possible.""

Test has been updated to reflect the IRGen.

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

6 years agoRevert r335063 as it causes bot failures
Alex Lorenz [Tue, 19 Jun 2018 19:43:07 +0000 (19:43 +0000)]
Revert r335063 as it causes bot failures

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

6 years agoRevert r335070 "[X86] Rewrite the max and min reduction intrinsics to make better...
Craig Topper [Tue, 19 Jun 2018 19:37:07 +0000 (19:37 +0000)]
Revert r335070 "[X86] Rewrite the max and min reduction intrinsics to make better use of other functions and to reduce width to 256 and 128 bits were possible."

The test changes are failing the buildbot and its going to take me some time to fix it.

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

6 years ago[X86] Rewrite the max and min reduction intrinsics to make better use of other functi...
Craig Topper [Tue, 19 Jun 2018 19:13:54 +0000 (19:13 +0000)]
[X86] Rewrite the max and min reduction intrinsics to make better use of other functions and to reduce width to 256 and 128 bits were possible.

We only need to use 512 bit vectors all the way through v8i64 reductions since those max instructions are new to avx512f and only available in 512 bits until SKX.

For v16i32 and floating point we have legacy 128/256 bit instructions we can use.

I've tried to use other intrinsics to reduce the verbosity of the code and avoid having to mention all the shuffles. I've also removed all the -1 shuffle indices so the output sequence is fully specified and not left to backend optimization.

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

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

6 years ago[Darwin] Add a warning for missing include path for libstdc++
Alex Lorenz [Tue, 19 Jun 2018 17:56:03 +0000 (17:56 +0000)]
[Darwin] Add a warning for missing include path for libstdc++

Xcode 10 removes support for libstdc++, but the users just get a confusing
include not file warning when including an STL header (when building for iOS6
which uses libstdc++ by default for example).
This patch adds a new warning that lets the user know that the libstdc++ include
path was not found to ensure that the user is more aware of why the error occurs.

rdar://40830462

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

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

6 years agoImplement semantic checking for __builtin_signbit.
Aaron Ballman [Tue, 19 Jun 2018 14:59:11 +0000 (14:59 +0000)]
Implement semantic checking for __builtin_signbit.

r242675 changed the signature for the signbit builtin but did not introduce proper semantic checking to ensure the arguments are as-expected. This patch groups the signbit builtin along with the other fp classification builtins. Fixes PR28172.

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

6 years agoReverting due to line ending changes; will reapply after addressing that.
Aaron Ballman [Tue, 19 Jun 2018 14:53:20 +0000 (14:53 +0000)]
Reverting due to line ending changes; will reapply after addressing that.

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

6 years agoImplement semantic checking for __builtin_signbit.
Aaron Ballman [Tue, 19 Jun 2018 14:36:04 +0000 (14:36 +0000)]
Implement semantic checking for __builtin_signbit.

r242675 changed the signature for the signbit builtin but did not introduce proper semantic checking to ensure the arguments are as-expected. This patch groups the signbit builtin along with the other fp classification builtins. Fixes PR28172.

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

6 years ago[analyzer] Made a buildbot happy.
Kristof Umann [Tue, 19 Jun 2018 08:35:02 +0000 (08:35 +0000)]
[analyzer] Made a buildbot happy.

Since `isPrimitiveType` was only used in an assert, a builbot with `-Werror`
and no asserts enabled failed to build it as it was unused.

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

6 years agoRevert r335019 "Update NRVO logic to support early return (Attempt 2)"
Taiju Tsuiki [Tue, 19 Jun 2018 05:35:30 +0000 (05:35 +0000)]
Revert r335019 "Update NRVO logic to support early return (Attempt 2)"

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

6 years ago[Sema] Produce diagnostics for attribute 'trivial_abi' that appears
Akira Hatanaka [Tue, 19 Jun 2018 05:04:44 +0000 (05:04 +0000)]
[Sema] Produce diagnostics for attribute 'trivial_abi' that appears
after the closing brace of a class declaration.

Merge the two call sites of checkIllFormedTrivialABIStruct and sink it
into CheckCompletedCXXClass so that it is called after the attribute has
been attached to the CXXRecordDecl.

rdar://problem/40873297

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

6 years agoUpdate NRVO logic to support early return (Attempt 2)
Taiju Tsuiki [Tue, 19 Jun 2018 04:39:07 +0000 (04:39 +0000)]
Update NRVO logic to support early return (Attempt 2)

Summary:
This is the second attempt of r333500 (Update NRVO logic to support early return).
The previous one was reverted for a miscompilation for an incorrect NRVO set up on templates such as:
```
struct Foo {};

template <typename T>
T bar() {
  T t;
  if (false)
    return T();
  return t;
}
```

Where, `t` is marked as non-NRVO variable before its instantiation. However, while its instantiation, it's left an NRVO candidate, turned into an NRVO variable later.

Reviewers: rsmith

Reviewed By: rsmith

Subscribers: cfe-commits

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

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

6 years agoIRgen: Mark aliases of ctors and dtors as unnamed_addr.
Peter Collingbourne [Mon, 18 Jun 2018 20:58:54 +0000 (20:58 +0000)]
IRgen: Mark aliases of ctors and dtors as unnamed_addr.

This is not only semantically correct but ensures that they will not
be marked as address-significant once D48155 lands.

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

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

6 years agoDon't let test/Driver/no-canonical-prefixes.c form a symlink cycle the second time...
Nico Weber [Mon, 18 Jun 2018 18:50:35 +0000 (18:50 +0000)]
Don't let test/Driver/no-canonical-prefixes.c form a symlink cycle the second time it runs.

The test makes %t.fake a symlink to %t.real by running `ln -sf %t.real
%t.fake`. If %t.fake already is a symlink to %t.real when this runs (e.g. if
the test has run before), then this effectively becomes `ln -sf %t.real %t.real`,
symlinking the directory to itself. At least on my mac, this leads to the
directory containing itself.

As fix, just remove %t.fake before creating the symlink. To clean up build dirs
on bots, also remove %t.real for a while.

https://reviews.llvm.org/D48224

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

6 years ago[analyzer] Remove accidentally committed lines.
George Karpenkov [Mon, 18 Jun 2018 17:59:03 +0000 (17:59 +0000)]
[analyzer] Remove accidentally committed lines.

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

6 years agoFix a bug introduced by rL334850
Tomasz Krupa [Mon, 18 Jun 2018 17:57:05 +0000 (17:57 +0000)]
Fix a bug introduced by rL334850

Summary: All *_sqrt_round_s[s|d] intrinsics should execute a square root on
zeroth element from B (Ops[1]) and insert in to A (Ops[0]), not the other way around.

Reviewers: itaraban, craig.topper

Reviewed By: craig.topper

Subscribers: craig.topper, cfe-commits

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

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

6 years ago[OPENMP, NVPTX] Emit simple reduction if requested.
Alexey Bataev [Mon, 18 Jun 2018 17:11:45 +0000 (17:11 +0000)]
[OPENMP, NVPTX] Emit simple reduction if requested.

If simple reduction is requested, use the simple reduction instead of
the runtime functions calls.

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

6 years agoUpdate copyright year to 2018.
Paul Robinson [Mon, 18 Jun 2018 12:22:17 +0000 (12:22 +0000)]
Update copyright year to 2018.

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

6 years ago[analyzer] Checker for uninitialized C++ objects
Kristof Umann [Mon, 18 Jun 2018 11:50:17 +0000 (11:50 +0000)]
[analyzer] Checker for uninitialized C++ objects

This checker analyzes C++ constructor calls, and reports uninitialized fields.

Due to the nature of this problem (uninitialized fields after an object
construction), this checker doesn't search for bugs, but rather is a tool to
enforce a specific programming model where every field needs to be initialized.

This checker lands in alpha for now, and a number of followup patches will be
made to reduce false negatives and to make it easier for the user to understand
what rules the checker relies on, eg. whether a derived class' constructor is
responsible for initializing inherited data members or whether it should be
handled in the base class' constructor.

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

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

6 years ago[ASTMatchers] Add support for matching the type of a friend decl.
David L. Jones [Mon, 18 Jun 2018 09:23:08 +0000 (09:23 +0000)]
[ASTMatchers] Add support for matching the type of a friend decl.

This allows matchers like:

  friendDecl(hasType(cxxRecordDecl(...)))
  friendDecl(hasType(asString(...)))

It seems that hasType is probably the most reasonable narrowing matcher to
overload, since it is already used to narrow to other declaration kinds.

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

Reviewers: klimek, aaron.ballman

Subscribers: cfe-commits

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

6 years ago[ASTMatchers] Don't assert-fail in specifiesTypeLoc().
David L. Jones [Mon, 18 Jun 2018 08:59:16 +0000 (08:59 +0000)]
[ASTMatchers] Don't assert-fail in specifiesTypeLoc().

The specifiesTypeLoc() matcher narrows a nestedNameSpecifier matcher based on a
typeloc within the NNS. However, the matcher does not guard against NNS which
are a namespace, and cause getTypeLoc to assert-fail.

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

6 years ago[analyzer] Add method to the generic SMT API to dump the SMT formula
Mikhail R. Gadelha [Sat, 16 Jun 2018 14:36:17 +0000 (14:36 +0000)]
[analyzer] Add method to the generic SMT API to dump the SMT formula

Summary:
New method dump the SMT formula and the Z3 implementation.

There is no test because I only used it for debugging.

However, if requested, I can add an option to the static analyzer to dump the formula (whole program? per path?), maybe something like the trimmed graph but for SMT formulas.

Reviewers: NoQ, george.karpenkov, ddcc

Reviewed By: george.karpenkov

Subscribers: xazax.hun, szepet, a.sidorin

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

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

6 years agoAdd RUN line for amdgcn to lit test conditional-temporaries.cpp
Yaxun Liu [Sat, 16 Jun 2018 12:28:51 +0000 (12:28 +0000)]
Add RUN line for amdgcn to lit test conditional-temporaries.cpp

This is partial re-commit of r332982.

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

6 years agoCall CreateTempAllocaWithoutCast for ActiveFlag
Yaxun Liu [Sat, 16 Jun 2018 01:20:52 +0000 (01:20 +0000)]
Call CreateTempAllocaWithoutCast for ActiveFlag

This is partial re-commit of r332982.

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

6 years ago[docs] -fsanitize=cfi only allowed with -fvisibility=
Fangrui Song [Fri, 15 Jun 2018 23:11:18 +0000 (23:11 +0000)]
[docs] -fsanitize=cfi only allowed with -fvisibility=

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

6 years ago[Modules] Improve .Private fix-its to handle 'explicit' and 'framework'
Bruno Cardoso Lopes [Fri, 15 Jun 2018 20:13:28 +0000 (20:13 +0000)]
[Modules] Improve .Private fix-its to handle 'explicit' and 'framework'

When in the context of suggestion the fix-it from .Private to _Private
for private modules, trim off the 'explicit' and add 'framework' when
appropriate.

rdar://problem/41030554

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

6 years ago[X86] Lowering sqrt intrinsics to native IR
Tomasz Krupa [Fri, 15 Jun 2018 18:05:59 +0000 (18:05 +0000)]
[X86] Lowering sqrt intrinsics to native IR

Reviewers: craig.topper, spatel, RKSimon, igorb, uriel.k

Reviewed By: craig.topper

Subscribers: tkrupa, cfe-commits

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

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

6 years ago[X86] __builtin_ia32_prord512_mask, __builtin_ia32_prorq512_mask, __builtin_ia32_shuf...
Craig Topper [Fri, 15 Jun 2018 17:40:37 +0000 (17:40 +0000)]
[X86] __builtin_ia32_prord512_mask, __builtin_ia32_prorq512_mask, __builtin_ia32_shufpd should only accept an ICE constant.

The rotates also need to check for the immediate to fit in 8-bits. Shufpd already checks its immediate range.

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

6 years ago[X86] The immediate argument to getmantpd*_mask should be an ICE and it should only...
Craig Topper [Fri, 15 Jun 2018 17:03:32 +0000 (17:03 +0000)]
[X86] The immediate argument to getmantpd*_mask should be an ICE and it should only be 4 bits wide.

We already checked this for the scalar version, but missed the vector version somehow.

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

6 years agobpf: recognize target specific option -mattr=dwarfris in clang
Yonghong Song [Fri, 15 Jun 2018 15:53:31 +0000 (15:53 +0000)]
bpf: recognize target specific option -mattr=dwarfris in clang

The following is the usage example with clang:
  bash-4.2$ clang -target bpf -O2 -g -c -Xclang -target-feature -Xclang +dwarfris t.c
  bash-4.2$ llvm-objdump -S -d t.o

  t.o:    file format ELF64-BPF

  Disassembly of section .text:
  test:
  ; int test(void) {
       0:       b7 00 00 00 00 00 00 00         r0 = 0
  ; return 0;
         1:       95 00 00 00 00 00 00 00         exit
  bash-4.2$ cat t.c
  int test(void) {
    return 0;
  }
  bash-4.2$

Signed-off-by: Yonghong Song <yhs@fb.com>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334839 91177308-0d34-0410-b5e6-96231b3b80d8

6 years ago[NFC] Add CreateMemTempWithoutCast and CreateTempAllocaWithoutCast
Yaxun Liu [Fri, 15 Jun 2018 15:33:22 +0000 (15:33 +0000)]
[NFC] Add CreateMemTempWithoutCast and CreateTempAllocaWithoutCast

This is partial re-commit of r332982

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

6 years ago[AArch64] Reverted rC334696 with Clang VCVTA test fix
Luke Geeson [Fri, 15 Jun 2018 10:10:45 +0000 (10:10 +0000)]
[AArch64] Reverted  rC334696 with Clang VCVTA test fix

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

6 years ago[ASTImporter] Corrected diagnostic client handling in tests.
Adam Balogh [Fri, 15 Jun 2018 06:45:39 +0000 (06:45 +0000)]
[ASTImporter] Corrected diagnostic client handling in tests.

ASTImporter tests may produce source file related warnings, the diagnostic
client should be in correct state to handle it. Added 'beginSourceFile' to set
the client state.

Patch by: Balázs Kéri

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

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

6 years ago[Format] Do not use a global static value for EOF within ScopedMacroState.
David L. Jones [Fri, 15 Jun 2018 06:08:54 +0000 (06:08 +0000)]
[Format] Do not use a global static value for EOF within ScopedMacroState.

ScopedMacroState injects its own EOF token under certain conditions, and the
returned token may be modified in several different locations. If multiple
reformat operations are started in different threads, then they will both see
the same fake EOF token, and may both try to modify it. This is a data race.

This bug was caught with tsan.

Reviewers: klimek

Subscribers: cfe-commits

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

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

6 years ago[cmake] Add linker detection for Apple platforms
Shoaib Meenai [Thu, 14 Jun 2018 23:26:33 +0000 (23:26 +0000)]
[cmake] Add linker detection for Apple platforms

LLVM currently assumes that Apple platforms will always use ld64. In the
future, LLD Mach-O might also be supported, so add the beginnings of
linker detection support. ld64 is currently the only detected linker,
since `ld64.lld -v` doesn't yield any useful version output, but we can
add that detection later, and in the meantime it's still useful to have
the ld64 identification.

Switch clang's order file check to use this new detection rather than
just checking for the presence of an ld64 executable.

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

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

6 years agoModules: Fix implicit output file for .cppm to .pcm instead of stdout
David Blaikie [Thu, 14 Jun 2018 23:09:06 +0000 (23:09 +0000)]
Modules: Fix implicit output file for .cppm to .pcm instead of stdout

This code was introduced back in r178148, a change to introduce
-module-file-info - which still exists & seems like it's still tested (&
this change didn't cause any of those tests to fail).

It doesn't look like this change was necessary there - since it's about
pcm output, whereas -module-file-info looks like it's for pcm /input/.
So I'm not really sure what the original motivation was.

I'm open to ideas though, if it turns out the original change was
necessary/useful.

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

6 years ago[X86] Rename __builtin_ia32_pslldqi128 to __builtin_ia32_pslldqi128_byteshift and...
Craig Topper [Thu, 14 Jun 2018 22:02:35 +0000 (22:02 +0000)]
[X86] Rename __builtin_ia32_pslldqi128 to __builtin_ia32_pslldqi128_byteshift and similar for other sizes. Remove the multiply by 8 from the header files.

The previous names took the shift amount in bits to match gcc and required a multiply by 8 in the header. This creates a misleading error message when we check the range of the immediate to the builtin since the allowed range also got multiplied by 8.

This commit changes the builtins to use a byte shift amount to match the underlying instruction and the Intel intrinsic.

Fixes the remaining issue from PR37795.

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

6 years ago[c++17] If a class inherits virtual functions from a base class, it is
Richard Smith [Thu, 14 Jun 2018 20:03:22 +0000 (20:03 +0000)]
[c++17] If a class inherits virtual functions from a base class, it is
not an aggregtae.

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

6 years ago[X86] Add inline assembly versions of _InterlockedExchange_HLEAcquire/Release and...
Craig Topper [Thu, 14 Jun 2018 18:43:52 +0000 (18:43 +0000)]
[X86] Add inline assembly versions of _InterlockedExchange_HLEAcquire/Release and _InterlockedCompareExchange_HLEAcquire/Release for MSVC compatibility.

Clang/LLVM doesn't have a way to pass an HLE hint through to the X86 backend to emit HLE prefixed instructions. So this is a good short term fix.

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

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

6 years ago[CMAKE][c-index-test] Honor CMAKE_OSX_SYSROOT to compute include dir for libxml2
Bruno Cardoso Lopes [Thu, 14 Jun 2018 18:20:04 +0000 (18:20 +0000)]
[CMAKE][c-index-test] Honor CMAKE_OSX_SYSROOT to compute include dir for libxml2

On MacOS, if CMAKE_OSX_SYSROOT is used and the user has command line tools
installed, we currently get the include path for libxml2 as
/usr/include/libxml2, instead of ${CMAKE_OSX_SYSROOT}/usr/include/libxml2.

Make it consistent on MacOS by prefixing ${CMAKE_OSX_SYSROOT} when
possible.

rdar://problem/41103601

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

6 years ago[X86] Lowering Mask Scalar intrinsics to native IR (Clang part)
Tomasz Krupa [Thu, 14 Jun 2018 17:36:23 +0000 (17:36 +0000)]
[X86] Lowering Mask Scalar intrinsics to native IR (Clang part)

Summary: Lowering add, sub, mul, and div mask scalar intrinsic calls
to native IR.

Reviewers: craig.topper, RKSimon, spatel, sroland

Reviewed By: craig.topper

Subscribers: cfe-commits

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

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

6 years ago[clang-format] Disable AlwaysBreakBeforeMultilineStrings in Google style for Objectiv...
Ben Hamilton [Thu, 14 Jun 2018 17:30:10 +0000 (17:30 +0000)]
[clang-format] Disable AlwaysBreakBeforeMultilineStrings in Google style for Objective-C ðŸ“œ

Contributed by @stephanemoore.

Reviewers: benhamilton, jolesiak, djasper

Reviewed By: benhamilton

Subscribers: klimek, cfe-commits

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

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

6 years ago[Fixed Point Arithmetic] Addition of the remaining fixed point types and their satura...
Leonard Chan [Thu, 14 Jun 2018 14:53:51 +0000 (14:53 +0000)]
[Fixed Point Arithmetic] Addition of the remaining fixed point types and their saturated equivalents

This diff includes changes for the remaining _Fract and _Sat fixed point types.

```
signed short _Fract s_short_fract;
signed _Fract s_fract;
signed long _Fract s_long_fract;
unsigned short _Fract u_short_fract;
unsigned _Fract u_fract;
unsigned long _Fract u_long_fract;

// Aliased fixed point types
short _Accum short_accum;
_Accum accum;
long _Accum long_accum;
short _Fract short_fract;
_Fract fract;
long _Fract long_fract;

// Saturated fixed point types
_Sat signed short _Accum sat_s_short_accum;
_Sat signed _Accum sat_s_accum;
_Sat signed long _Accum sat_s_long_accum;
_Sat unsigned short _Accum sat_u_short_accum;
_Sat unsigned _Accum sat_u_accum;
_Sat unsigned long _Accum sat_u_long_accum;
_Sat signed short _Fract sat_s_short_fract;
_Sat signed _Fract sat_s_fract;
_Sat signed long _Fract sat_s_long_fract;
_Sat unsigned short _Fract sat_u_short_fract;
_Sat unsigned _Fract sat_u_fract;
_Sat unsigned long _Fract sat_u_long_fract;

// Aliased saturated fixed point types
_Sat short _Accum sat_short_accum;
_Sat _Accum sat_accum;
_Sat long _Accum sat_long_accum;
_Sat short _Fract sat_short_fract;
_Sat _Fract sat_fract;
_Sat long _Fract sat_long_fract;
```

This diff only allows for declaration of these 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.

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

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

6 years agoclang-format: Fix documentation generation
Francois Ferrand [Thu, 14 Jun 2018 13:32:14 +0000 (13:32 +0000)]
clang-format: Fix documentation generation

Summary:
It seems that the changes done to `ClangFormatStyleOptions.rst` @334408 are causing the generation of the documentation to fail, with the following error:

  Warning, treated as error:
    /llvm/tools/clang/docs/ClangFormatStyleOptions.rst:1060: WARNING: Definition list ends without a blank line; unexpected unindent.

This is due to missing indent in some code block, and fixed by this patch.

Reviewers: krasimir, djasper, klimek

Reviewed By: krasimir

Subscribers: cfe-commits

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

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

6 years ago[OpenCL] Support new/delete in Sema
Sven van Haastregt [Thu, 14 Jun 2018 09:51:54 +0000 (09:51 +0000)]
[OpenCL] Support new/delete in Sema

Reject uses of the default new/delete operators with a diagnostic
instead of a crash in OpenCL C++ mode and accept user-defined forms.

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

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

6 years ago[AArch64] reverting rC334693 due to build failures
Luke Geeson [Thu, 14 Jun 2018 08:59:33 +0000 (08:59 +0000)]
[AArch64] reverting rC334693 due to build failures

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

6 years agoRemoved trunk-Codegen directory added in error
Luke Geeson [Thu, 14 Jun 2018 08:51:52 +0000 (08:51 +0000)]
Removed trunk-Codegen directory added in error

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

6 years ago[AArch64] Added support for the vcvta_u16_f16 instrinsic for FP16 Armv8.2-A
Luke Geeson [Thu, 14 Jun 2018 08:28:56 +0000 (08:28 +0000)]
[AArch64] Added support for the vcvta_u16_f16 instrinsic for FP16 Armv8.2-A

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

6 years ago[clang-format] Add SpaceBeforeCpp11BracedList option.
Hans Wennborg [Thu, 14 Jun 2018 08:01:09 +0000 (08:01 +0000)]
[clang-format] Add SpaceBeforeCpp11BracedList option.

WebKit C++ style for object initialization is as follows:

  Foo foo { bar };

Yet using clang-format -style=webkit changes this to:

  Foo foo{ bar };

As there is no existing combination of rules that will ensure a space
before a braced list in this fashion, this patch adds a new
SpaceBeforeCpp11BracedList rule.

Patch by Ross Kirsling!

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

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

6 years ago[analyzer] Re-enable C++17-specific RVO construction contexts.
Artem Dergachev [Thu, 14 Jun 2018 01:59:35 +0000 (01:59 +0000)]
[analyzer] Re-enable C++17-specific RVO construction contexts.

Not contexts themselves, but rather support for them in the analyzer.

Such construction contexts appear when C++17 mandatory copy elision occurs
while returning an object from a function, and presence of a destructor causes
a CXXBindTemporaryExpr to appear in the AST.

Additionally, such construction contexts may be chained, because a return-value
construction context doesn't really explain where the object is being returned
into, but only points to the parent stack frame, where the object may be
consumed by literally anything including another return statement. This
behavior is now modeled correctly by the analyzer as long as the object is not
returned beyond the boundaries of the analysis.

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

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

6 years ago[analyzer] Re-enable C++17-specific variable and member construction contexts.
Artem Dergachev [Thu, 14 Jun 2018 01:54:21 +0000 (01:54 +0000)]
[analyzer] Re-enable C++17-specific variable and member construction contexts.

Not contexts themselves, but rather support for them in the analyzer.

Such construction contexts appear when C++17 mandatory copy elision occurs
during initialization, and presence of a destructor causes a
CXXBindTemporaryExpr to appear in the AST.

Similar C++17-specific constructors for return values are still to be supported.

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

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

6 years ago[analyzer] Track class member initializer constructors path-sensitively.
Artem Dergachev [Thu, 14 Jun 2018 01:40:49 +0000 (01:40 +0000)]
[analyzer] Track class member initializer constructors path-sensitively.

The reasoning behind this change is similar to the previous commit, r334681.
Because members are already in scope when construction occurs, we are not
suffering from liveness problems, but we still want to figure out if the object
was constructed with construction context, because in this case we'll be able
to avoid trivial copy, which we don't always model perfectly. It'd also have
more importance when copy elision is implemented.

This also gets rid of the old CFG look-behind mechanism.

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

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

6 years ago[analyzer] pr37270: Track constructor target region, even if just a variable.
Artem Dergachev [Thu, 14 Jun 2018 01:32:46 +0000 (01:32 +0000)]
[analyzer] pr37270: Track constructor target region, even if just a variable.

The very idea of construction context implies that first the object is
constructed, and then later, in a separate moment of time, the constructed
object goes into scope, i.e. becomes "live".

Most construction contexts require path-sensitive tracking of the constructed
object region in order to compute the outer expressions accordingly before
the object becomes live.

Semantics of simple variable construction contexts don't immediately require
that such tracking happens in path-sensitive manner, but shortcomings of the
analyzer force us to track it path-sensitively as well. Namely, whether
construction context was available at all during construction is a
path-sensitive information. Additionally, path-sensitive tracking takes care of
our liveness problems that kick in as the temporal gap between construction and
going-into-scope becomes larger (eg., due to copy elision).

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

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

6 years ago[analyzer] NFC: Merge code for finding and tracking construction target.
Artem Dergachev [Thu, 14 Jun 2018 01:20:12 +0000 (01:20 +0000)]
[analyzer] NFC: Merge code for finding and tracking construction target.

When analyzing C++ code, a common operation in the analyzer is to discover
target region for object construction by looking at CFG metadata ("construction
contexts"), and then track the region path-sensitively until object construction
is resolved, where the amount of information, again, depends on construction
context.

Scan construction context only once for both purposes.

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

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

6 years agoP0096R5, P0941R2: Update to match latest feature test macro specification.
Richard Smith [Thu, 14 Jun 2018 00:40:20 +0000 (00:40 +0000)]
P0096R5, P0941R2: Update to match latest feature test macro specification.

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

6 years ago[www] Update cxx_status page for Rapperswil motions.
Richard Smith [Thu, 14 Jun 2018 00:05:28 +0000 (00:05 +0000)]
[www] Update cxx_status page for Rapperswil motions.

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

6 years agoDriver: De-duplicate some code. NFCI.
Peter Collingbourne [Thu, 14 Jun 2018 00:03:41 +0000 (00:03 +0000)]
Driver: De-duplicate some code. NFCI.

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

6 years agodocs: Add a missing LTO visibility reference.
Peter Collingbourne [Wed, 13 Jun 2018 23:21:02 +0000 (23:21 +0000)]
docs: Add a missing LTO visibility reference.

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

6 years agodocs: Correct some misstatements in the control flow integrity docs.
Peter Collingbourne [Wed, 13 Jun 2018 23:18:26 +0000 (23:18 +0000)]
docs: Correct some misstatements in the control flow integrity docs.

These were true at one point but haven't been true for a long time.

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

6 years agoSimplify test from r334650
Erich Keane [Wed, 13 Jun 2018 20:47:12 +0000 (20:47 +0000)]
Simplify test from r334650

No reason to have the 'bool' as an intermediary value,
simply use the fact that curley braces enforce eval order.

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

6 years agoImplement constexpr __builtin_*_overflow
Erich Keane [Wed, 13 Jun 2018 20:43:27 +0000 (20:43 +0000)]
Implement constexpr __builtin_*_overflow

As requested here:https://bugs.llvm.org/show_bug.cgi?id=37633
permit the __builtin_*_overflow builtins in constexpr functions.

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

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

6 years ago[COFF] Add ARM64 intrinsics: __yield, __wfe, __wfi, __sev, __sevl
Mandeep Singh Grang [Wed, 13 Jun 2018 18:49:35 +0000 (18:49 +0000)]
[COFF] Add ARM64 intrinsics: __yield, __wfe, __wfi, __sev, __sevl

Summary: These intrinsics result in hint instructions. They are provided here for MSVC ARM64 compatibility.

Reviewers: mstorsjo, compnerd, javed.absar

Reviewed By: mstorsjo

Subscribers: kristof.beyls, chrib, cfe-commits

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

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

6 years ago[analyzer] Fix offset overflow check in MemRegion
George Karpenkov [Wed, 13 Jun 2018 18:32:19 +0000 (18:32 +0000)]
[analyzer] Fix offset overflow check in MemRegion

rdar://39593879
https://bugs.llvm.org/show_bug.cgi?id=37142

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

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

6 years ago[CodeGen] make nan builtins pure rather than const (PR37778)
Sanjay Patel [Wed, 13 Jun 2018 17:54:52 +0000 (17:54 +0000)]
[CodeGen] make nan builtins pure rather than const (PR37778)

https://bugs.llvm.org/show_bug.cgi?id=37778
...shows a miscompile resulting from marking nan builtins as 'const'.

The nan libcalls/builtins take a pointer argument:
http://www.cplusplus.com/reference/cmath/nan-function/
...and the chars dereferenced by that arg are used to fill in the NaN constant payload bits.

"const" means that the pointer argument isn't dereferenced. That's translated to "readnone" in LLVM.
"pure" means that the pointer argument may be dereferenced. That's translated to "readonly" in LLVM.

This change prevents the IR optimizer from killing the lead-up to the nan call here:

double a() {
  char buf[4];
  buf[0] = buf[1] = buf[2] = '9';
  buf[3] = '\0';
  return __builtin_nan(buf);
}

...the optimizer isn't currently able to simplify this to a constant as we might hope,
but this patch should solve the miscompile.

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

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

6 years ago[Basic] Fix -Wreorder warning
Benjamin Kramer [Wed, 13 Jun 2018 16:45:12 +0000 (16:45 +0000)]
[Basic] Fix -Wreorder warning

Just use field initializers that don't suffer from this problem

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

6 years ago[PowerPC] The __float128 type should only be available on Power9
Stefan Pintilie [Wed, 13 Jun 2018 16:05:05 +0000 (16:05 +0000)]
[PowerPC] The __float128 type should only be available on Power9

Diasble the use of the type __float128 for PPC machines older
than Power9.

The use of -mfloat128 for PPC machine older than Power9 will result
in an error.

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

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

6 years ago[libclang] Make c-index-test.c ISO C90 compliant.
Matt Morehouse [Wed, 13 Jun 2018 16:00:39 +0000 (16:00 +0000)]
[libclang] Make c-index-test.c ISO C90 compliant.

Fixes a build bot breakage caused by r334593.

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

6 years agoAdd -fforce-emit-vtables
Piotr Padlewski [Wed, 13 Jun 2018 13:55:42 +0000 (13:55 +0000)]
Add -fforce-emit-vtables

Summary:
 In many cases we can't devirtualize
 because definition of vtable is not present. Most of the
 time it is caused by inline virtual function not beeing
 emitted. Forcing emitting of vtable adds a reference of these
 inline virtual functions.
 Note that GCC was always doing it.

Reviewers: rjmccall, rsmith, amharc, kuhar

Subscribers: llvm-commits, cfe-commits

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

Co-authored-by: Krzysztof Pszeniczny <krzysztof.pszeniczny@gmail.com>
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@334600 91177308-0d34-0410-b5e6-96231b3b80d8

6 years agoCorrect behavior of __builtin_*_overflow and constexpr.
Erich Keane [Wed, 13 Jun 2018 13:25:11 +0000 (13:25 +0000)]
Correct behavior of __builtin_*_overflow and constexpr.

Enable these builtins to be called across a lambda
boundary with captureless const/constexpr, as brought up by
Eli here: https://reviews.llvm.org/D48040

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

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

6 years ago[libclang] Optionally add code completion results for arrow instead of dot
Ivan Donchevskii [Wed, 13 Jun 2018 12:37:08 +0000 (12:37 +0000)]
[libclang] Optionally add code completion results for arrow instead of dot

Follow up for D41537 - libclang part.

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

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

6 years ago[X86] Remove masking from avx512vbmi2 concat and shift by immediate builtins. Use...
Craig Topper [Wed, 13 Jun 2018 07:19:28 +0000 (07:19 +0000)]
[X86] Remove masking from avx512vbmi2 concat and shift by immediate builtins. Use select builtins instead.

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

6 years agocrash-report-modules.m: Shorten path length to make Windows bot happy
Hans Wennborg [Wed, 13 Jun 2018 06:48:40 +0000 (06:48 +0000)]
crash-report-modules.m: Shorten path length to make Windows bot happy

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

6 years agoRemove extraneous semicolon.
Bill Wendling [Wed, 13 Jun 2018 06:33:59 +0000 (06:33 +0000)]
Remove extraneous semicolon.

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

6 years ago[Sema] When the address of a member function is used as a template
Akira Hatanaka [Wed, 13 Jun 2018 05:26:23 +0000 (05:26 +0000)]
[Sema] When the address of a member function is used as a template
argument, use the context in which it is used for checking its
accessibility.

This fixes PR32898.

rdar://problem/33737747

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

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

6 years agoFix crash emitting transparent list initializer for a large aggregate.
Richard Smith [Wed, 13 Jun 2018 02:06:28 +0000 (02:06 +0000)]
Fix crash emitting transparent list initializer for a large aggregate.

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

6 years ago[CUDA][HIP] Allow CUDA __global__ functions to have amdgpu kernel attributes
Yaxun Liu [Tue, 12 Jun 2018 23:58:59 +0000 (23:58 +0000)]
[CUDA][HIP] Allow CUDA __global__ functions to have amdgpu kernel attributes

There are HIP applications e.g. Tensorflow 1.3 using amdgpu kernel attributes, however
currently they are only allowed on OpenCL kernel functions.

This patch will allow amdgpu kernel attributes to be applied to CUDA/HIP __global__
functions.

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

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

6 years ago[analyzer] Do not crash in the visitor when the function is given more arguments...
George Karpenkov [Tue, 12 Jun 2018 23:53:54 +0000 (23:53 +0000)]
[analyzer] Do not crash in the visitor when the function is given more arguments than it has parameters

rdar://40335545

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

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

6 years ago[analyzer] Ensure that loop widening does not invalidate references
Matthew Voss [Tue, 12 Jun 2018 22:22:35 +0000 (22:22 +0000)]
[analyzer] Ensure that loop widening does not invalidate references

Loop widening can invalidate a reference. If the analyzer attempts to visit the
destructor to a non-existent reference, it will crash. This patch ensures that
the reference is preserved.

https://reviews.llvm.org/D47044

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

6 years ago[CMake][Darwin] Match cxx-headers -> cxx_headers libcxx target rename.
Ahmed Bougacha [Tue, 12 Jun 2018 21:27:36 +0000 (21:27 +0000)]
[CMake][Darwin] Match cxx-headers -> cxx_headers libcxx target rename.

This was changed in r334477.

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

6 years ago[analyzer] [NFC] Remove "removeInvalidation" from visitor API
George Karpenkov [Tue, 12 Jun 2018 20:51:19 +0000 (20:51 +0000)]
[analyzer] [NFC] Remove "removeInvalidation" from visitor API

removeInvalidation is a very problematic API, as it makes suppression
order-dependent.
Moreover, it was used only once, and could be rewritten in a much
cleaner way.

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

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

6 years ago[analyzer] [NFC] Move ::dump methods from BugReporter.cpp to PathDiagnostics.cpp
George Karpenkov [Tue, 12 Jun 2018 20:51:01 +0000 (20:51 +0000)]
[analyzer] [NFC] Move ::dump methods from BugReporter.cpp to PathDiagnostics.cpp

BugReporter.cpp is already severely overloaded, and those dump methods
are on PathDiagnostics and should belong in the corresponding
implementation file.

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

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

6 years ago[analyzer] [NFC] Remove most usages of getEndPath
George Karpenkov [Tue, 12 Jun 2018 20:50:44 +0000 (20:50 +0000)]
[analyzer] [NFC] Remove most usages of getEndPath

getEndPath is a problematic API, because it's not clear when it's called
(hint: not always at the end of the path), it crashes at runtime with
more than one non-nullptr returning implementation, and diagnostics
internal depend on it being called at some exact place.

However, most visitors don't actually need that: all they want is a
function consistently called after all nodes are traversed, to perform
finalization and to decide whether invalidation is needed.

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

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

6 years agoWork around false -Wmissing-braces warning from old clang which has been fixed in...
Fangrui Song [Tue, 12 Jun 2018 20:44:11 +0000 (20:44 +0000)]
Work around false -Wmissing-braces warning from old clang which has been fixed in r314838

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

6 years ago[AArch64] Support reserving x20 register
Petr Hosek [Tue, 12 Jun 2018 20:00:50 +0000 (20:00 +0000)]
[AArch64] Support reserving x20 register

Register x20 is a callee-saved register which may be used for other
purposes in certain contexts, for example to hold special variables
within the kernel. This change adds support for reserving this register
both to frontend and backend to make this register usable for these
purposes.

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

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

6 years ago[clang-format] Fix crash while reflowing backslash in comments
Krasimir Georgiev [Tue, 12 Jun 2018 19:33:15 +0000 (19:33 +0000)]
[clang-format] Fix crash while reflowing backslash in comments

Summary:
The added test case was currently crashing with an assertion:
```
krasimir@krasimir> cat test.cc                                                                                                                                                              ~
// How to run:
// bbbbb run \
// rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr \
// <log_file> -- --output_directory="<output_directory>"
krasimir@krasimir> ~/work/llvm-build/bin/clang-format test.cc                                                                                                                               ~
clang-format: /usr/local/google/home/krasimir/work/llvm/tools/clang/lib/Format/WhitespaceManager.cpp:117: void clang::format::WhitespaceManager::calculateLineBreakInformation(): Assertion `PreviousOriginalWhitespaceEndOffset <= OriginalWhitespaceStartOffset' failed.
```
The root cause was that BreakableToken was not considering the case of a reflow between an unescaped newline in a line comment.

Subscribers: cfe-commits

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

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

6 years ago[analyzer] [NFC] Now let's have only one place for diagnostics generation
George Karpenkov [Tue, 12 Jun 2018 19:08:17 +0000 (19:08 +0000)]
[analyzer] [NFC] Now let's have only one place for diagnostics generation

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

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

6 years ago[analyzer] [NFC] Unify Minimal and Extensive diagnostics.
George Karpenkov [Tue, 12 Jun 2018 19:08:00 +0000 (19:08 +0000)]
[analyzer] [NFC] Unify Minimal and Extensive diagnostics.

Once we removed AlternateExtensive, I've looked closer into the
difference between Minimal and Extensive, and turns out, the difference
was not that large.

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

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

6 years ago[analyzer] [NFC] Remove unused Extensive diagnostic setting,
George Karpenkov [Tue, 12 Jun 2018 19:07:41 +0000 (19:07 +0000)]
[analyzer] [NFC] Remove unused Extensive diagnostic setting,

Rename AlternateExtensive to Extensive.
In 2013, five years ago, we have switched to AlternateExtensive
diagnostics by default, and Extensive was available under unused,
undocumented flag.
This change remove the flag, renames the Alternate
diagnostic to Extensive (as it's no longer Alternate), and ports the
test.

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

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

6 years agoRefactor ExecuteAndWait to take StringRefs.
Zachary Turner [Tue, 12 Jun 2018 17:43:52 +0000 (17:43 +0000)]
Refactor ExecuteAndWait to take StringRefs.

This simplifies some code which had StringRefs to begin with, and
makes other code more complicated which had const char* to begin
with.

In the end, I think this makes for a more idiomatic and platform
agnostic API.  Not all platforms launch process with null terminated
c-string arrays for the environment pointer and argv, but the api
was designed that way because it allowed easy pass-through for
posix-based platforms.  There's a little additional overhead now
since on posix based platforms we'll be takign StringRefs which
were constructed from null terminated strings and then copying
them to null terminate them again, but from a readability and
usability standpoint of the API user, I think this API signature
is strictly better.

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