platform/upstream/llvm.git
5 years ago[ASTMatchers] Introduce a matcher for `ObjCIvarExpr`, support getting it's declaration
George Karpenkov [Fri, 27 Jul 2018 17:40:59 +0000 (17:40 +0000)]
[ASTMatchers] Introduce a matcher for `ObjCIvarExpr`, support getting it's declaration

ObjCIvarExpr is *not* a subclass of MemberExpr, and a separate matcher
is required to support it.
Adding a hasDeclaration support as well, as it's not very useful without
it.

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

llvm-svn: 338140

5 years ago[OPENMP] Static variables on device must be externally visible.
Alexey Bataev [Fri, 27 Jul 2018 17:37:32 +0000 (17:37 +0000)]
[OPENMP] Static variables on device must be externally visible.

Do not mark static variable as internal on the device as they must be
visible from the host to be mapped correctly.

llvm-svn: 338139

5 years ago[demangler] Support for reference collapsing
Erik Pilkington [Fri, 27 Jul 2018 17:27:40 +0000 (17:27 +0000)]
[demangler] Support for reference collapsing

llvm.org/PR38323

llvm-svn: 338138

5 years ago[ASTMatchers] Introduce a matcher for `ObjCIvarExpr`, support getting it's declaration.
George Karpenkov [Fri, 27 Jul 2018 17:26:11 +0000 (17:26 +0000)]
[ASTMatchers] Introduce a matcher for `ObjCIvarExpr`, support getting it's declaration.

ObjCIvarExpr is *not* a subclass of MemberExpr, and a separate matcher
is required to support it.
Adding a hasDeclaration support as well, as it's not very useful without
it.

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

llvm-svn: 338137

5 years agoRevert "Enable MachineOutliner by default under -Oz for AArch64"
Jessica Paquette [Fri, 27 Jul 2018 17:25:38 +0000 (17:25 +0000)]
Revert "Enable MachineOutliner by default under -Oz for AArch64"

It failed an Asan test on a bot:

http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/21543/steps/check-llvm%20asan/logs/stdio

Fixing that before recommitting.

llvm-svn: 338136

5 years agoAdd missing temporary materialization conversion on left-hand side of .
Richard Smith [Fri, 27 Jul 2018 17:13:18 +0000 (17:13 +0000)]
Add missing temporary materialization conversion on left-hand side of .
in some member function calls.

Specifically, when calling a conversion function, we would fail to
create the AST node representing materialization of the class object.

llvm-svn: 338135

5 years agobpf: add missing RegState to notify MachineInstr verifier necessary register usage
Yonghong Song [Fri, 27 Jul 2018 16:58:52 +0000 (16:58 +0000)]
bpf: add missing RegState to notify MachineInstr verifier necessary register usage

Errors like the following are reported by:

  https://urldefense.proofpoint.com/v2/url?u=http-3A__lab.llvm.org-3A8011_builders_llvm-2Dclang-2Dx86-5F64-2Dexpensive-2Dchecks-2Dwin_builds_11261&d=DwIBAg&c=5VD0RTtNlTh3ycd41b3MUw&r=DA8e1B5r073vIqRrFz7MRA&m=929oWPCf7Bf2qQnir4GBtowB8ZAlIRWsAdTfRkDaK-g&s=9k-wbEUVpUm474hhzsmAO29VXVvbxJPWD9RTgCD71fQ&e=

  *** Bad machine code: Explicit definition marked as use ***
  - function:    cal_align1
  - basic block: %bb.0 entry (0x47edd98)
  - instruction: LDB $r3, $r2, 0
  - operand 0:   $r3

This is because RegState info was missing for ScratchReg inside
expandMEMCPY. This caused incomplete register usage information to
MachineInstr verifier which then would complain as there could be potential
code-gen issue if the complained MachineInstr is used in place where
register usage information matters even though the memcpy expanding is not
in such case as it happens at the last stage of IR optimization pipeline.

We should always specify those register usage information which compiler
couldn't deduct automatically whenever we add a hardware register manually.

Reported-by: Builder llvm-clang-x86_64-expensive-checks-win Build #11261
Signed-off-by: Jiong Wang <jiong.wang@netronome.com>
Reviewed-by: Yonghong Song <yhs@fb.com>
llvm-svn: 338134

5 years agoEnable MachineOutliner by default under -Oz for AArch64
Jessica Paquette [Fri, 27 Jul 2018 16:44:42 +0000 (16:44 +0000)]
Enable MachineOutliner by default under -Oz for AArch64

This patch enables the MachineOutliner by default in AArch64 under -Oz.

The MachineOutliner offers around a 4.5% improvement on the current -Oz code
size improvements.

We have done work into improving the debuggability of outlined code, so that
users of -Oz won't be surprised by the optimization. We have also been executing
the LLVM test suite and common external tests such as the SPEC suites
continuously with no issue. The outliner has a low compile-time overhead of
roughly 1%. At this point, the outliner would be a really good addition to the
-Oz pass pipeline!

llvm-svn: 338133

5 years ago[DAGCombiner] fold 'not' with signbit math
Sanjay Patel [Fri, 27 Jul 2018 16:42:55 +0000 (16:42 +0000)]
[DAGCombiner] fold 'not' with signbit math

This is a follow-up suggested in D48970.

Alive proofs:
https://rise4fun.com/Alive/sII

We can eliminate an instruction in the usual select-of-constants
to bit hack transform by adjusting the add/sub with constant.
This is always a win.

There are more transforms that are likely wins, but they may need
target hooks in case some targets do not benefit.

This is another step towards making up for canonicalizing to
select-of-constants in rL331486.

llvm-svn: 338132

5 years ago[x86] add more tests for signbit math; NFC
Sanjay Patel [Fri, 27 Jul 2018 16:22:40 +0000 (16:22 +0000)]
[x86] add more tests for signbit math; NFC

llvm-svn: 338131

5 years ago[PowerPC] add more tests for signbit math; NFC
Sanjay Patel [Fri, 27 Jul 2018 16:22:18 +0000 (16:22 +0000)]
[PowerPC] add more tests for signbit math; NFC

llvm-svn: 338130

5 years ago[AArch64] add more tests for signbit math; NFC
Sanjay Patel [Fri, 27 Jul 2018 16:21:56 +0000 (16:21 +0000)]
[AArch64] add more tests for signbit math; NFC

llvm-svn: 338129

5 years ago[Support] Use unsigned char for xxHash 64-bit
Fangrui Song [Fri, 27 Jul 2018 16:01:09 +0000 (16:01 +0000)]
[Support] Use unsigned char for xxHash 64-bit

Before, the last 3 bytes were char-signedness dependent.

llvm-svn: 338128

5 years agoAMDGPU/R600: Add MOV instructions to BFE patterns
Jan Vesely [Fri, 27 Jul 2018 15:00:13 +0000 (15:00 +0000)]
AMDGPU/R600: Add MOV instructions to BFE patterns

R600 can't handle immediates for BFE, these will be eliminated later.
Fixes powr/pow regressions n r600 since r334817

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

llvm-svn: 338127

5 years ago[AArch64][SVE] Asm: Predicated integer reductions.
Sander de Smalen [Fri, 27 Jul 2018 14:24:55 +0000 (14:24 +0000)]
[AArch64][SVE] Asm: Predicated integer reductions.

This patch adds support for various integer reduction operations:

  SADDV    signed add reduction to scalar
  UADDV    unsigned add reduction to scalar

  SMAXV    signed maximum reduction to scalar
  SMINV    signed minimum reduction to scalar
  UMAXV    unsigned maximum reduction to scalar
  UMINV    unsigned minimum reduction to scalar

  ANDV     logical AND reduction to scalar
  ORV      logical OR reduction to scalar
  EORV     logical EOR reduction to scalar

The reduction is predicated, e.g.
  smaxv s0, p0, z1.s

performs a signed maximum reduction on active elements in z1,
and stores the (signed max value) result in s0.

llvm-svn: 338126

5 years ago[AMDGPU][MC][DOC] Updated AMD GPU assembler description
Dmitry Preobrazhensky [Fri, 27 Jul 2018 14:17:15 +0000 (14:17 +0000)]
[AMDGPU][MC][DOC] Updated AMD GPU assembler description

llvm-svn: 338125

5 years ago[clang-tidy] Fix a crash in fuchsia-multiple-inheritance
Ilya Biryukov [Fri, 27 Jul 2018 14:05:39 +0000 (14:05 +0000)]
[clang-tidy] Fix a crash in fuchsia-multiple-inheritance

Summary: See the test case for a repro.

Reviewers: juliehockett, ioeric, hokein, aaron.ballman

Reviewed By: hokein

Subscribers: lebedev.ri, xazax.hun, cfe-commits

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

llvm-svn: 338124

5 years ago[AArch64][SVE] Asm: Predicated floating point reductions.
Sander de Smalen [Fri, 27 Jul 2018 13:58:48 +0000 (13:58 +0000)]
[AArch64][SVE] Asm: Predicated floating point reductions.

This patch adds support for various floating-point
reduction operations:

  FADDA    strictly-ordered add reduction, accumulating in scalar
  FADDV    recursive add reduction to scalar
  FMAXV    recursive max reduction to scalar
  FMINV    recursive min reduction to scalar
  FMAXNMV  recursive max number reduction to scalar
  FMINNMV  recursive min number reduction to scalar

The reduction is predicated, e.g.

  fadda d0, p0, d0, z1.d

performs the add-reduction in strict order on active elements
in z1, accumulating into d0.

  faddv d0, p0, z1.d

performs the add-reduction (not in strict order)
on active elements in z1, storing the result in d0.

llvm-svn: 338123

5 years ago[libc++] Introduce _LIBCPP_HIDE_FROM_ABI to replace _LIBCPP_INLINE_VISIBILITY
Louis Dionne [Fri, 27 Jul 2018 12:46:03 +0000 (12:46 +0000)]
[libc++] Introduce _LIBCPP_HIDE_FROM_ABI to replace _LIBCPP_INLINE_VISIBILITY

Summary:
This commit introduces a new macro, _LIBCPP_HIDE_FROM_ABI, whose goal is to
mark functions that shouldn't be part of libc++'s ABI. It marks the functions
as being hidden for dylib visibility purposes, and as having internal linkage
using Clang's __attribute__((internal_linkage)) when available, and
__always_inline__ otherwise.

It replaces _LIBCPP_INLINE_VISIBILITY, which was always using __always_inline__
to achieve similar goals, but suffered from debuggability and code size problems.
The full proposal, along with more background information, can be found here:

    http://lists.llvm.org/pipermail/cfe-dev/2018-July/058419.html

This commit does not rename uses of _LIBCPP_INLINE_VISIBILITY to
_LIBCPP_HIDE_FROM_ABI: this wide reaching but mechanical change can
be done later when we've confirmed we're happy with the new macro.

In the future, it would be nice if we could optionally allow dropping
any internal_linkage or __always_inline__ attribute, which could result
in code size improvements. However, this is currently impossible for
reasons explained here: http://lists.llvm.org/pipermail/cfe-dev/2018-July/058450.html

Reviewers: EricWF, dexonsmith, mclow.lists

Subscribers: christof, dexonsmith, llvm-commits, mclow.lists

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

llvm-svn: 338122

5 years ago[AArch64][SVE] Asm: Support for FEXPA and FTSSEL.
Sander de Smalen [Fri, 27 Jul 2018 12:40:09 +0000 (12:40 +0000)]
[AArch64][SVE] Asm: Support for FEXPA and FTSSEL.

This patch adds support for transcendental acceleration
instructions 'FEXPA' (exponential accelerator) and 'FTSSEL'
(trigonometric select coefficient).

llvm-svn: 338121

5 years ago[AArch64][SVE] Asm: Support for FRECPE and FRSQRTE.
Sander de Smalen [Fri, 27 Jul 2018 12:26:24 +0000 (12:26 +0000)]
[AArch64][SVE] Asm: Support for FRECPE and FRSQRTE.

Support for floating-point instructions for reciprocal
estimate (FRECPE) and reciprocal square root estimate (FRSQRTE).

llvm-svn: 338120

5 years ago[CMake] Followup for r337366: Only export LLVM_LINK_LLVM_DYLIB if it's set to ON
Philip Pfaffe [Fri, 27 Jul 2018 10:57:51 +0000 (10:57 +0000)]
[CMake] Followup for r337366: Only export LLVM_LINK_LLVM_DYLIB if it's set to ON

Summary:
As it was, always exporting LLVM_LINK_LLVM_DYLIB caused out-of-tree
clients to lose the ability to link against the dylib, even if in-tree tools did
not. By only exporting the setting if it is enabled, out-of-tree clients get the
correct default, but may still choose if they can.

Reviewers: mgorny, beanz, labath, bogner, chandlerc

Reviewed By: bogner, chandlerc

Subscribers: bollu, llvm-commits

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

llvm-svn: 338119

5 years ago[InstCombine] not(sub X, Y) --> add (not X), Y
Sanjay Patel [Fri, 27 Jul 2018 10:54:48 +0000 (10:54 +0000)]
[InstCombine] not(sub X, Y) --> add (not X), Y

The tests with constants show a missing optimization.
Analysis for adds is better than subs, so this can also
help with other transforms. And codegen is better with
adds for targets like x86 (destructive ops, no sub-from).

https://rise4fun.com/Alive/llK

llvm-svn: 338118

5 years ago[InstCombine] add tests for not+sub; NFC
Sanjay Patel [Fri, 27 Jul 2018 10:45:04 +0000 (10:45 +0000)]
[InstCombine] add tests for not+sub; NFC

llvm-svn: 338117

5 years ago[clangd] Return Dex Iterators
Kirill Bobyrev [Fri, 27 Jul 2018 09:54:27 +0000 (09:54 +0000)]
[clangd] Return Dex Iterators

The original Dex Iterators patch (https://reviews.llvm.org/rL338017)
caused problems for Clang 3.6 and Clang 3.7 due to the compiler bug
which prevented inferring template parameter (`Size`) in create(And|Or)?
functions. It was reverted in https://reviews.llvm.org/rL338054.

In this revision the mentioned helper functions were replaced with
variadic templated versions.

Proposed changes were tested on multiple compiler versions, including
Clang 3.6 which originally caused the failure.

llvm-svn: 338116

5 years ago[SimplifyIndVar] Canonicalize comparisons to unsigned while eliminating truncs
Max Kazantsev [Fri, 27 Jul 2018 09:43:39 +0000 (09:43 +0000)]
[SimplifyIndVar] Canonicalize comparisons to unsigned while eliminating truncs

This is a follow-up for the patch rL335020. When we replace compares against
trunc with compares against wide IV, we can also replace signed predicates with
unsigned where it is legal.

Reviewed By: reames
Differential Revision: https://reviews.llvm.org/D48763

llvm-svn: 338115

5 years ago[Support] Bring std::errc::not_supported to llvm::errc.
Victor Leschuk [Fri, 27 Jul 2018 09:15:05 +0000 (09:15 +0000)]
[Support] Bring std::errc::not_supported to llvm::errc.

llvm-svn: 338114

5 years agoAMDGPU: Fix code size for return_to_epilog pseudo
Matt Arsenault [Fri, 27 Jul 2018 09:15:03 +0000 (09:15 +0000)]
AMDGPU: Fix code size for return_to_epilog pseudo

llvm-svn: 338113

5 years agoDAG: Remove unnecessary .str()
Matt Arsenault [Fri, 27 Jul 2018 09:04:41 +0000 (09:04 +0000)]
DAG: Remove unnecessary .str()

llvm-svn: 338112

5 years agoPatternMatch: Add wrappers for fabs and canonicalize
Matt Arsenault [Fri, 27 Jul 2018 09:04:35 +0000 (09:04 +0000)]
PatternMatch: Add wrappers for fabs and canonicalize

llvm-svn: 338111

5 years agoRevert "ELF: Make --print-icf-sections output deterministic."
Ilya Biryukov [Fri, 27 Jul 2018 09:01:03 +0000 (09:01 +0000)]
Revert "ELF: Make --print-icf-sections output deterministic."

This reverts commit r338088. To unbreak our integrate.
The resulting lld output is different if compiled with '-funsigned-char'.

llvm-svn: 338110

5 years agoRevert "[LV][DebugInfo] Set DL to the middle block Icmp instruction"
Anastasis Grammenos [Fri, 27 Jul 2018 08:22:54 +0000 (08:22 +0000)]
Revert "[LV][DebugInfo] Set DL to the middle block Icmp instruction"

This reverts commit r338106.

llvm-svn: 338109

5 years ago[AST] Sink 'part of explicit cast' down into ImplicitCastExpr
Roman Lebedev [Fri, 27 Jul 2018 07:27:14 +0000 (07:27 +0000)]
[AST] Sink 'part of explicit cast' down into ImplicitCastExpr

Summary:
As discussed in IRC with @rsmith, it is slightly not good to keep that in the `CastExpr` itself:
Given the explicit cast, which is represented in AST as an `ExplicitCastExpr` + `ImplicitCastExpr`'s,
only the  `ImplicitCastExpr`'s will be marked as `PartOfExplicitCast`, but not the `ExplicitCastExpr` itself.
Thus, it is only ever `true` for `ImplicitCastExpr`'s, so we don't need to write/read/dump it for `ExplicitCastExpr`'s.

We don't need to worry that we write the `PartOfExplicitCast` in PCH after `CastExpr::path_iterator`,
since the `ExprImplicitCastAbbrev` is only used when the `NumBaseSpecs == 0`, i.e. there is no 'path'.

Reviewers: rsmith, rjmccall, erichkeane, aaron.ballman

Reviewed By: rsmith, erichkeane

Subscribers: vsk, cfe-commits, rsmith

Tags: #clang

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

llvm-svn: 338108

5 years ago[InstSimplify] tests for D48828: fold extraction from std::pair
Hiroshi Inoue [Fri, 27 Jul 2018 07:21:02 +0000 (07:21 +0000)]
[InstSimplify] tests for D48828: fold extraction from std::pair

This commit includes unit tests for D48828, which enhances InstSimplify to enable jump threading with a method whose return type is std::pair<int, bool> or std::pair<bool, int>.
I am going to commit the actual transformation later.

llvm-svn: 338107

5 years ago[LV][DebugInfo] Set DL to the middle block Icmp instruction
Anastasis Grammenos [Fri, 27 Jul 2018 07:12:44 +0000 (07:12 +0000)]
[LV][DebugInfo] Set DL to the middle block Icmp instruction

Reviewers: hsaito

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

llvm-svn: 338106

5 years ago[Docs] Remove hard tab character from code block in optbisect documentation
Craig Topper [Fri, 27 Jul 2018 06:54:13 +0000 (06:54 +0000)]
[Docs] Remove hard tab character from code block in optbisect documentation

llvm-svn: 338105

5 years ago[NFC] Remove an empty line.
Xin Tong [Fri, 27 Jul 2018 06:50:45 +0000 (06:50 +0000)]
[NFC] Remove an empty line.

llvm-svn: 338104

5 years agoMove Filesystem namespace definition out of a clang specific ifdef block.
Eric Fiselier [Fri, 27 Jul 2018 06:12:46 +0000 (06:12 +0000)]
Move Filesystem namespace definition out of a clang specific ifdef block.

llvm-svn: 338103

5 years agoAMDGPU/GlobalISel: Fix crash in regbankselect on non-power-of-2 types
Tom Stellard [Fri, 27 Jul 2018 06:04:40 +0000 (06:04 +0000)]
AMDGPU/GlobalISel: Fix crash in regbankselect on non-power-of-2 types

Reviewers: arsenm

Reviewed By: arsenm

Subscribers: kzhuravl, wdng, nhaehnle, yaxunl, rovka, kristof.beyls, dstuttard, tpr, llvm-commits, t-tye

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

llvm-svn: 338102

5 years ago[X86] Remove an unnecessary 'if' that prevented treating INT64_MAX and -INT64_MAX...
Craig Topper [Fri, 27 Jul 2018 05:56:27 +0000 (05:56 +0000)]
[X86] Remove an unnecessary 'if' that prevented treating INT64_MAX and -INT64_MAX as power of 2 minus 1 in the multiply expansion code.

Not sure why they were being explicitly excluded, but I believe all the math inside the if works. I changed the absolute value to be uint64_t instead of int64_t so INT64_MIN+1 wouldn't be signed wrap.

llvm-svn: 338101

5 years ago[LTO] Don't internalize declarations
Bob Haarman [Fri, 27 Jul 2018 05:40:29 +0000 (05:40 +0000)]
[LTO] Don't internalize declarations

Summary:
Some links were failing with "Global is external, but doesn't have
external or weak linkage!" in ThinLTO builds with debug
information. This happened when we elide the body of a global that is
referenced by debug info. This results in a declaration, which we
would then internalize - but declarations cannot be internal. This
change avoids the problem by not internalizing these declarations.

Fixes PR38046.

Reviewers: pcc, tejohnson

Subscribers: mehdi_amini, aprantl, hiraditya, JDevlieghere, steven_wu, dexonsmith, llvm-commits

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

llvm-svn: 338100

5 years agoReplace LLVM_ALIGNAS with alignas as a follow-up of r337330
Fangrui Song [Fri, 27 Jul 2018 05:38:14 +0000 (05:38 +0000)]
Replace LLVM_ALIGNAS with alignas as a follow-up of r337330

The minimum required GCC version was raised to 4.8 (which started to support alignas) in r284497.

llvm-svn: 338099

5 years ago[WWW] Fixing file permissions for the .html pages.
Mike Edwards [Fri, 27 Jul 2018 04:41:37 +0000 (04:41 +0000)]
[WWW] Fixing file permissions for the .html pages.

llvm-svn: 338098

5 years ago[X86] Add matching for another pattern of PMADDWD.
Craig Topper [Fri, 27 Jul 2018 04:29:10 +0000 (04:29 +0000)]
[X86] Add matching for another pattern of PMADDWD.

Summary:
This is the pattern you get from the loop vectorizer for something like this

int16_t A[1024];
int16_t B[1024];
int32_t C[512];

void pmaddwd() {
  for (int i = 0; i != 512; ++i)
    C[i] = (A[2*i]*B[2*i]) + (A[2*i+1]*B[2*i+1]);
}

In this case we will have (add (mul (build_vector), (build_vector)), (mul (build_vector), (build_vector))). This is different than the pattern we currently match which has the build_vectors between an add and a single multiply. I'm not sure what C code would get you that pattern.

Reviewers: RKSimon, spatel, zvi

Reviewed By: zvi

Subscribers: llvm-commits

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

llvm-svn: 338097

5 years agoAdd libc++fs to the test deps, and not to the target 'cxx'.
Eric Fiselier [Fri, 27 Jul 2018 03:47:46 +0000 (03:47 +0000)]
Add libc++fs to the test deps, and not to the target 'cxx'.

llvm-svn: 338096

5 years agoAttempt to unbreak *all the bots*
Eric Fiselier [Fri, 27 Jul 2018 03:42:58 +0000 (03:42 +0000)]
Attempt to unbreak *all the bots*

The bots were failing to build the cxx_filesystem target, so the
tests were failing. Though this does lead me to wonder how it
was ever working with c++experimental.

llvm-svn: 338095

5 years agoCorrectly mark the Filesystem status as complete.
Eric Fiselier [Fri, 27 Jul 2018 03:16:02 +0000 (03:16 +0000)]
Correctly mark the Filesystem status as complete.

llvm-svn: 338094

5 years agoImplement <filesystem>
Eric Fiselier [Fri, 27 Jul 2018 03:07:09 +0000 (03:07 +0000)]
Implement <filesystem>

This patch implements the <filesystem> header and uses that
to provide <experimental/filesystem>.

Unlike other standard headers, the symbols needed for <filesystem>
have not yet been placed in libc++.so. Instead they live in the
new libc++fs.a library. Users of filesystem are required to link this
library. (Also note that libc++experimental no longer contains the
definition of <experimental/filesystem>, which now requires linking libc++fs).

The reason for keeping <filesystem> out of the dylib for now is that
it's still somewhat experimental, and the possibility of requiring an
ABI breaking change is very real. In the future the symbols will likely
be moved into the dylib, or the dylib will be made to link libc++fs automagically).

Note that moving the symbols out of libc++experimental may break user builds
until they update to -lc++fs. This should be OK, because the experimental
library provides no stability guarantees. However, I plan on looking into
ways we can force libc++experimental to automagically link libc++fs.

In order to use a single implementation and set of tests for <filesystem>, it
has been placed in a special `__fs` namespace. This namespace is inline in
C++17 onward, but not before that. As such implementation is available
in C++11 onward, but no filesystem namespace is present "directly", and
as such name conflicts shouldn't occur in C++11 or C++14.

llvm-svn: 338093

5 years ago[InstCombine] canonicalize abs pattern
Chen Zheng [Fri, 27 Jul 2018 01:49:51 +0000 (01:49 +0000)]
[InstCombine] canonicalize abs pattern
Differential Revision: https://reviews.llvm.org/D48754

llvm-svn: 338092

5 years agoadded shared library to fix buildbot
Emmett Neyman [Fri, 27 Jul 2018 00:43:26 +0000 (00:43 +0000)]
added shared library to fix buildbot

Summary: added shared library to fix buildbot

Subscribers: mgorny, cfe-commits

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

llvm-svn: 338091

5 years ago[X86] When removing sign extends from gather/scatter indices, make sure we handle...
Craig Topper [Fri, 27 Jul 2018 00:00:30 +0000 (00:00 +0000)]
[X86] When removing sign extends from gather/scatter indices, make sure we handle UpdateNodeOperands finding an existing node to CSE with.

If this happens the operands aren't updated and the existing node is returned. Make sure we pass this existing node up to the DAG combiner so that a proper replacement happens. Otherwise we get stuck in an infinite loop with an unoptimized node.

llvm-svn: 338090

5 years ago[Sema] Fix a crash by completing a type before using it
Erik Pilkington [Thu, 26 Jul 2018 23:40:42 +0000 (23:40 +0000)]
[Sema] Fix a crash by completing a type before using it

Only apply this exception on a type that we're able to check.

rdar://41903969

Differential revision: https://reviews.llvm.org/D49868

llvm-svn: 338089

5 years agoELF: Make --print-icf-sections output deterministic.
Peter Collingbourne [Thu, 26 Jul 2018 23:34:35 +0000 (23:34 +0000)]
ELF: Make --print-icf-sections output deterministic.

The icf-safe.s test currently fails on 32-bit platforms because it uses
the --print-icf-sections flag and depends on the output appearing in
a specific order. However, this flag causes the output to depend on
the order of the sections in the Sections array, which depends on the
hash values returned from hash_combine, which happen to be different
for that test between 32-bit and 64-bit platforms.

This change makes the output deterministic by using xxHash64 instead of
hash_combine.

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

llvm-svn: 338088

5 years ago[WWW] Removing my test file as the auto-deployment script has been fixed.
Mike Edwards [Thu, 26 Jul 2018 23:29:54 +0000 (23:29 +0000)]
[WWW] Removing my test file as the auto-deployment script has been fixed.

llvm-svn: 338087

5 years ago[WWW] Adding a test page to work out an auto-deployment issue.
Mike Edwards [Thu, 26 Jul 2018 23:23:40 +0000 (23:23 +0000)]
[WWW] Adding a test page to work out an auto-deployment issue.

llvm-svn: 338086

5 years ago[SelectionDAGBuilder] Add masked loads to PendingLoads rather than calling DAG.setRoot.
Craig Topper [Thu, 26 Jul 2018 23:22:11 +0000 (23:22 +0000)]
[SelectionDAGBuilder] Add masked loads to PendingLoads rather than calling DAG.setRoot.

Masked loads are calling DAG.getRoot rather than calling SelectionDAGBuilder::getRoot, which means the PendingLoads weren't emptied to update the root and create any needed TokenFactor. So it would be incorrect to call setRoot for the masked load.

This patch instead adds the masked load to PendingLoads so that the root doesn't get update until a store or scatter or something happens.. Alternatively, we could call SelectionDAGBuilder::getRoot before it, but that would create unnecessary serialization.

llvm-svn: 338085

5 years agoRevert r338057 "[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with...
Reid Kleckner [Thu, 26 Jul 2018 23:21:51 +0000 (23:21 +0000)]
Revert r338057 "[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name"

This broke clang/test/PCH/case-insensitive-include.c on Windows.

llvm-svn: 338084

5 years ago[MS] Add L__FUNCSIG__ for compatibility
Reid Kleckner [Thu, 26 Jul 2018 23:18:44 +0000 (23:18 +0000)]
[MS] Add L__FUNCSIG__ for compatibility

Clang already has L__FUNCTION__ as a workaround for dealing with
pre-processor code that expects to be able to do L##__FUNCTION__ in a
macro. This patch implements the same logic for __FUNCSIG__.

Fixes PR38295.

llvm-svn: 338083

5 years ago[InstrProf] Use comdats on COFF for available_externally functions
Reid Kleckner [Thu, 26 Jul 2018 22:59:17 +0000 (22:59 +0000)]
[InstrProf] Use comdats on COFF for available_externally functions

Summary:
r262157 added ELF-specific logic to put a comdat on the __profc_*
globals created for available_externally functions. We should be able to
generalize that logic to all object file formats that support comdats,
i.e. everything other than MachO. This fixes duplicate symbol errors,
since on COFF, linkonce_odr doesn't make the symbol weak.

Fixes PR38251.

Reviewers: davidxl, xur

Subscribers: hiraditya, dmajor, llvm-commits, aheejin

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

llvm-svn: 338082

5 years ago[DWARF v5] Reposting r337981, which was reverted in r337997 due to a test failure...
Wolfgang Pieb [Thu, 26 Jul 2018 22:48:52 +0000 (22:48 +0000)]
[DWARF v5] Reposting r337981, which was reverted in r337997 due to a test failure in debuginfo_tests.
The test failure was caused by the compiler not emitting a __debug_ranges section with DWARF 4 and
earlier when no ranges are needed. The test checks for the existence regardless.

llvm-svn: 338081

5 years ago[SelectionDAG] Add MLOAD/MSTORE/MGATHER/MSCATTER to AddNodeIDCustom to properly calcu...
Craig Topper [Thu, 26 Jul 2018 22:40:24 +0000 (22:40 +0000)]
[SelectionDAG] Add MLOAD/MSTORE/MGATHER/MSCATTER to AddNodeIDCustom to properly calculate their folding set ID to allow them to be CSEd.

llvm-svn: 338080

5 years ago[DAGCombiner] Remove some calls to AddToWorklist that should be unnecessary.
Craig Topper [Thu, 26 Jul 2018 22:40:22 +0000 (22:40 +0000)]
[DAGCombiner] Remove some calls to AddToWorklist that should be unnecessary.

The DAGCombiner has a system for ensuring all nodes are visited. It doesn't require an AddToWorkList for every node that is created by a combine.

llvm-svn: 338079

5 years agoFix -Wsign-compare warning.
Zachary Turner [Thu, 26 Jul 2018 22:24:01 +0000 (22:24 +0000)]
Fix -Wsign-compare warning.

llvm-svn: 338078

5 years agoUpdated llvm-proto-fuzzer to execute the compiled code
Emmett Neyman [Thu, 26 Jul 2018 22:23:25 +0000 (22:23 +0000)]
Updated llvm-proto-fuzzer to execute the compiled code

Summary:
Made changes to the llvm-proto-fuzzer
- Added loop vectorizer optimization pass in order to have two IR versions
- Updated old fuzz target to handle two different IR versions
- Wrote code to execute both versions in memory

Reviewers: morehouse, kcc, alexshap

Reviewed By: morehouse

Subscribers: pcc, mgorny, cfe-commits, llvm-commits

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

llvm-svn: 338077

5 years ago[ARM64] [Windows] Follow MS X86_64 C++ ABI when passing structs
Sanjin Sijaric [Thu, 26 Jul 2018 22:18:28 +0000 (22:18 +0000)]
[ARM64] [Windows] Follow MS X86_64 C++ ABI when passing structs

Summary: Microsoft's C++ object model for ARM64 is the same as that for X86_64.
For example, small structs with non-trivial copy constructors or virtual
function tables are passed indirectly.  Currently, they are passed in registers
when compiled with clang.

Reviewers: rnk, mstorsjo, TomTan, haripul, javed.absar

Reviewed By: rnk, mstorsjo

Subscribers: kristof.beyls, chrib, llvm-commits, cfe-commits

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

llvm-svn: 338076

5 years ago[MS Demangler] Properly handle function parameter back-refs.
Zachary Turner [Thu, 26 Jul 2018 22:13:39 +0000 (22:13 +0000)]
[MS Demangler] Properly handle function parameter back-refs.

Properly demangle function parameter back-references.

Previously we treated lists of function parameters and template
parameters the same. There are some important differences with regards
to back-references, and some less important differences regarding which
characters can appear before or after the name.

The important differences are that with a given type T, all instances of
a function parameter list share the same global back-ref table.
Specifically, if X and Y are function pointers, then there are 3
entities in the declaration X func(Y) which all affect and are affected
by the master parameter back-ref table:
  1) The parameter list of X's function type
  2) the parameter list of func itself
  3) The parameter list of Y's function type.

The previous code would create a back-reference table that was local to
a single parameter list, so it would not be shared across parameter
lists.

This was discovered when porting ms-back-references.test from clang's
mangling tests. All of these tests should now pass with the new changes.

In doing so, I split the function for parsing template and function
parameters into two separate functions. This makes the template
parameter list parsing code in particular very small and easy to
understand now.

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

llvm-svn: 338075

5 years agoAdd back lldb-framework-headers target
Alex Langford [Thu, 26 Jul 2018 21:55:14 +0000 (21:55 +0000)]
Add back lldb-framework-headers target

In r338058 we removed the target `lldb-framework-headers`, which mean
lldb-framework no longer depended on `framework_headers`, so they never
actually got generated. This is a partial revert of r338058: I added
back the lldb-framework-headers target, but the framework-header-fix.sh
script still runs on the copied headers.

llvm-svn: 338074

5 years ago[SCEV] Don't expand Wrap predicate using inttoptr in ni addrspaces
Keno Fischer [Thu, 26 Jul 2018 21:55:06 +0000 (21:55 +0000)]
[SCEV] Don't expand Wrap predicate using inttoptr in ni addrspaces

Summary:
In non-integral address spaces, we're not allowed to introduce inttoptr/ptrtoint
intrinsics. Instead, we need to expand any pointer arithmetic as geps on the
base pointer. Luckily this is a common task for SCEV, so all we have to do here
is hook up the corresponding helper function and add test case.

Fixes PR38290

Reviewers: sanjoy
Differential Revision: https://reviews.llvm.org/D49832

llvm-svn: 338073

5 years ago[SCEV] Add an expandAddToGEP overload for a single operand. NFC.
Keno Fischer [Thu, 26 Jul 2018 21:55:03 +0000 (21:55 +0000)]
[SCEV] Add an expandAddToGEP overload for a single operand. NFC.

Only wanting to pass a single SCEV operand to use as the offset of
the GEP is a common operation. Right now this requires creating a
temporary stack array at every call site. Add an overload
that encapsulates that pattern and simplify the call sites.

Suggested-By: sanjoy (in https://reviews.llvm.org/D49832)
llvm-svn: 338072

5 years agoADT: Document advantages of SmallVector<T,0> over std::vector
Duncan P. N. Exon Smith [Thu, 26 Jul 2018 21:29:54 +0000 (21:29 +0000)]
ADT: Document advantages of SmallVector<T,0> over std::vector

In light of the recent changes to SmallVector in r335421, r337514, and
r337820, document its advantages over std::vector (see r175906 and
r266909).

Also add a release note.

https://reviews.llvm.org/D49748

llvm-svn: 338071

5 years ago[RegisterCoalescer] Fixed inconsistent followCopyChain with subreg
Tim Renouf [Thu, 26 Jul 2018 21:27:34 +0000 (21:27 +0000)]
[RegisterCoalescer] Fixed inconsistent followCopyChain with subreg

Summary:
The behavior of followCopyChain with a subreg depends on the order in
which subranges appear in a live interval, which is bad.

This commit fixes that, and allows the copy chain to continue only if
all matching subranges that are not undefined take us to the same def.

I don't have a test for this; the reproducer I had on my branch with
various other local changes does not reproduce the problem on upstream
llvm. Also that reproducer was an ll test; attempting to convert it to a
mir test made the subranges appear in a different order and hid the
problem.

However I would argue that the old behavior was obviously wrong
and needs fixing.

Subscribers: MatzeB, qcolombet, llvm-commits

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

Change-Id: Iee7936ef305918f3b498ac432e2cf651ae5cc2df
llvm-svn: 338070

5 years ago[DebugInfo] LowerDbgDeclare: Add derefs when handling CallInst users
Vedant Kumar [Thu, 26 Jul 2018 20:56:53 +0000 (20:56 +0000)]
[DebugInfo] LowerDbgDeclare: Add derefs when handling CallInst users

LowerDbgDeclare inserts a dbg.value before each use of an address
described by a dbg.declare. When inserting a dbg.value before a CallInst
use, however, it fails to append DW_OP_deref to the DIExpression.

The DW_OP_deref is needed to reflect the fact that a dbg.value describes
a source variable directly (as opposed to a dbg.declare, which relies on
pointer indirection).

This patch adds in the DW_OP_deref where needed. This results in the
correct values being shown during a debug session for a program compiled
with ASan and optimizations (see https://reviews.llvm.org/D49520). Note
that ConvertDebugDeclareToDebugValue is already correct -- no changes
there were needed.

One complication is that SelectionDAG is unable to distinguish between
direct and indirect frame-index (FRAMEIX) SDDbgValues. This patch also
fixes this long-standing issue in order to not regress integration tests
relying on the incorrect assumption that all frame-index SDDbgValues are
indirect. This is a necessary fix: the newly-added DW_OP_derefs cannot
be lowered properly otherwise. Basically the fix prevents a direct
SDDbgValue with DIExpression(DW_OP_deref) from being dereferenced twice
by a debugger. There were a handful of tests relying on this incorrect
"FRAMEIX => indirect" assumption which actually had incorrect
DW_AT_locations: these are all fixed up in this patch.

Testing:

- check-llvm, and an end-to-end test using lldb to debug an optimized
  program.
- Existing unit tests for DIExpression::appendToStack fully cover the
  new DIExpression::append utility.
- check-debuginfo (the debug info integration tests)

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

llvm-svn: 338069

5 years ago[MS Demangler] Print calling convention inside parentheses.
Zachary Turner [Thu, 26 Jul 2018 20:33:48 +0000 (20:33 +0000)]
[MS Demangler] Print calling convention inside parentheses.

For function pointers, we would print something like

int __cdecl (*)(int)

We need to move the calling convention inside, and print

int (__cdecl *)(int)

This patch implements this change for regular function pointers as
well as member function pointers.

llvm-svn: 338068

5 years ago[MS Demangler] Add ms-arg-qualifiers.test
Zachary Turner [Thu, 26 Jul 2018 20:25:35 +0000 (20:25 +0000)]
[MS Demangler] Add ms-arg-qualifiers.test

This converts the arg qualifier mangling tests from
clang/CodeGenCXX/mangle-ms-arg-qualifiers.cpp to demangling tests.
Most tests already pass, so this patch doesn't come with any
functional change, just the addition of new tests.  The few tests
that don't pass are left in with a FIXME label so that they don't
run but serve as documentation about what still doesn't work.

llvm-svn: 338067

5 years agoAdd missing tests from ms-mangle.cpp.
Zachary Turner [Thu, 26 Jul 2018 20:20:29 +0000 (20:20 +0000)]
Add missing tests from ms-mangle.cpp.

None of these tests pass yet so they are commented out, but I'm
adding them with a FIXME label so that they don't get lost when
copying tests over from clang's mangling tests.  Currently these
tests are all commented out.

llvm-svn: 338066

5 years ago[MS Demangler] Demangle pointers to member functions.
Zachary Turner [Thu, 26 Jul 2018 20:20:10 +0000 (20:20 +0000)]
[MS Demangler] Demangle pointers to member functions.

After this patch, we can now properly demangle pointers to member
functions.  The calling convention is located in the wrong place,
but this will be fixed in a followup since it also affects non
member function pointers.

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

llvm-svn: 338065

5 years ago[COFF] Handle comdat sections without leader symbols
Martin Storsjo [Thu, 26 Jul 2018 20:14:50 +0000 (20:14 +0000)]
[COFF] Handle comdat sections without leader symbols

Discard them unless they have been associated by other means (yet
uimplemented).

According to MS link.exe, such sections are illegal, but MinGW setups
use them in their take on associative comdats.

This avoids leaving references to the bogus SectionChunk* PendingComdat,
which cannot be dereferenced.

This fixes PR38183.

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

llvm-svn: 338064

5 years ago[MC] Add support for the .rva assembler directive for COFF targets
Martin Storsjo [Thu, 26 Jul 2018 20:11:26 +0000 (20:11 +0000)]
[MC] Add support for the .rva assembler directive for COFF targets

Even though gas doesn't document it, it has been supported there for
a very long time.

This produces the 32 bit relative virtual address (aka image relative
address) for a given symbol. ".rva foo" is essentially equal to
".long foo@imgrel".

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

llvm-svn: 338063

5 years agoHandle the lack of a symbol table correctly.
Stephen Hines [Thu, 26 Jul 2018 20:05:31 +0000 (20:05 +0000)]
Handle the lack of a symbol table correctly.

Summary:
These two cases will trigger a dereference on a nullptr, since the
SymbolTable can be nonexistent for a given library, in addition to just
being empty.

Reviewers: alexshap

Reviewed By: alexshap

Subscribers: meikeb, kongyi, chh, jakehehrlich, llvm-commits, pirama

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

llvm-svn: 338062

5 years ago[MS Demangler] Demangle data member pointers.
Zachary Turner [Thu, 26 Jul 2018 19:56:09 +0000 (19:56 +0000)]
[MS Demangler] Demangle data member pointers.

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

llvm-svn: 338061

5 years ago[AMDGPU] Fix VGPR spills where offset doesn't fit in 12 bits
Scott Linder [Thu, 26 Jul 2018 19:47:51 +0000 (19:47 +0000)]
[AMDGPU] Fix VGPR spills where offset doesn't fit in 12 bits

Scale the offset of VGPR spills by the wave size when it cannot fit in the
12-bit offset immediate field and so is added to the soffset SGPR. This
accounts for hardware swizzling of scratch memory.

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

llvm-svn: 338060

5 years ago[InstCombine] fold udiv with common factor from muls with nuw
Sanjay Patel [Thu, 26 Jul 2018 19:22:41 +0000 (19:22 +0000)]
[InstCombine] fold udiv with common factor from muls with nuw

Unfortunately, sdiv isn't as simple because of UB due to overflow.

This fold is mentioned in PR38239:
https://bugs.llvm.org/show_bug.cgi?id=38239

llvm-svn: 338059

5 years agoMake framework-header-fix process copied headers
Alex Langford [Thu, 26 Jul 2018 19:04:46 +0000 (19:04 +0000)]
Make framework-header-fix process copied headers

Summary:
Previously the framework-header-fix script would change the sources
before they were copied, leading to unnecessary rebuilds on repeat
`ninja lldb` invocations. This runs the script on the headers after
they're copied into the produced LLDB.framework, meaning it doesn't
affect any files being built.

Patch by Keith Smiley <keithbsmiley@gmail.com>!

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

llvm-svn: 338058

5 years ago[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested...
Simon Marchi [Thu, 26 Jul 2018 18:55:02 +0000 (18:55 +0000)]
[VirtualFileSystem] InMemoryFileSystem::status: Return a Status with the requested name

Summary:

InMemoryFileSystem::status behaves differently than
RealFileSystem::status.  The Name contained in the Status returned by
RealFileSystem::status will be the path as requested by the caller,
whereas InMemoryFileSystem::status returns the normalized path.

For example, when requested the status for "../src/first.h",
RealFileSystem returns a Status with "../src/first.h" as the Name.
InMemoryFileSystem returns "/absolute/path/to/src/first.h".

The reason for this change is that I want to make a unit test in the
clangd testsuite (where we use an InMemoryFileSystem) to reproduce a
bug I get with the clangd program (where a RealFileSystem is used).
This difference in behavior "hides" the bug in the unit test version.

Reviewers: malaperle, ilya-biryukov, bkramer

Subscribers: cfe-commits, ioeric, ilya-biryukov, bkramer, hokein, omtcyfz

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

llvm-svn: 338057

5 years agoRefactor checking of switch conditions and case values.
Richard Smith [Thu, 26 Jul 2018 18:41:30 +0000 (18:41 +0000)]
Refactor checking of switch conditions and case values.

Check each case value in turn while parsing it, performing the
conversion to the switch type within the context of the expression
itself. This will become necessary in order to properly handle cleanups
for temporaries created as part of the case label (in an upcoming
patch). For now it's just good hygiene.

This necessitates moving the checking for the switch condition itself to
earlier, so that the destination type is available when checking the
case labels.

As a nice side-effect, we get slightly improved diagnostic quality and
error recovery by separating the case expression checking from the case
statement checking and from tracking whether there are discarded case
labels.

llvm-svn: 338056

5 years ago[OPENMP, DOCS] Fixed typo, NFC.
Alexey Bataev [Thu, 26 Jul 2018 18:40:41 +0000 (18:40 +0000)]
[OPENMP, DOCS] Fixed typo, NFC.

llvm-svn: 338055

5 years agoRevert Clangd Dex Iterators patch
Kirill Bobyrev [Thu, 26 Jul 2018 18:25:48 +0000 (18:25 +0000)]
Revert Clangd Dex Iterators patch

This reverts two revisions:

* https://reviews.llvm.org/rL338017
* https://reviews.llvm.org/rL338028

They caused crash for Clang 3.6 & Clang 3.7 buildbots, it was
reported by Jeremy Morse.

llvm-svn: 338054

5 years ago[test] Use printf instead of C++ iostream, NFC.
Jonas Hahnfeld [Thu, 26 Jul 2018 18:23:40 +0000 (18:23 +0000)]
[test] Use printf instead of C++ iostream, NFC.

This test fails with libc++ when built with MemorySanitizer. This
is because we link to an uninstrumented version of the library
so msan detects a nested error when calling std::cout << "...".
This can be easily avoided by using good old printf.

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

llvm-svn: 338053

5 years agoPR30734: Remove __kmp_ft_page_allocate()
Jonas Hahnfeld [Thu, 26 Jul 2018 18:15:02 +0000 (18:15 +0000)]
PR30734: Remove __kmp_ft_page_allocate()

This function was not enabled by default and not exported when manually
tweaking the build flags. Additionally it was hard to use since there
is no corresponding __kmp_ft_page_free().
The code itself is questionable because the returned memory address
is padded by an extra pointer which stores the unpadded start of the
allocated region (this would need to be freed).

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

llvm-svn: 338052

5 years ago[test] Remove XFAIL of omp_for_bigbounds.c for Intel Compiler
Jonas Hahnfeld [Thu, 26 Jul 2018 18:14:57 +0000 (18:14 +0000)]
[test] Remove XFAIL of omp_for_bigbounds.c for Intel Compiler

The initial commit said that the test passes with Intel Compiler,
so change XFAIL to only list clang and gcc.

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

llvm-svn: 338051

5 years ago[COFF, ARM64] Decide when to mark struct returns as SRet
Mandeep Singh Grang [Thu, 26 Jul 2018 18:07:59 +0000 (18:07 +0000)]
[COFF, ARM64] Decide when to mark struct returns as SRet

Summary:
Refer the MS ARM64 ABI Convention for the behavior for struct returns:
https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions#return-values

Reviewers: mstorsjo, compnerd, rnk, javed.absar, yinma, efriedma

Reviewed By: rnk, efriedma

Subscribers: haripul, TomTan, yinma, efriedma, kristof.beyls, chrib, llvm-commits

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

llvm-svn: 338050

5 years ago[OPENMP] What's new for OpenMP in clang.
Alexey Bataev [Thu, 26 Jul 2018 17:53:45 +0000 (17:53 +0000)]
[OPENMP] What's new for OpenMP in clang.

Updated ReleaseNotes + Status of the OpenMP support in clang.

llvm-svn: 338049

5 years ago[Sema][ObjC] Do not propagate the nullability specifier on the receiver
Akira Hatanaka [Thu, 26 Jul 2018 17:51:13 +0000 (17:51 +0000)]
[Sema][ObjC] Do not propagate the nullability specifier on the receiver
to the result type of a message send if the result type cannot have a
nullability specifier.

Previously, clang would print the following message when the code in
nullability.m was compiled:

"incompatible integer to pointer conversion initializing 'int *' with
an expression of type 'int _Nullable'"

This is wrong as 'int' isn't supposed to have any nullability
specifiers.

rdar://problem/40830514

llvm-svn: 338048

5 years ago[RISCV] Add support for _interrupt attribute
Ana Pazos [Thu, 26 Jul 2018 17:49:43 +0000 (17:49 +0000)]
[RISCV] Add support for _interrupt attribute

- Save/restore only registers that are used.
This includes Callee saved registers and Caller saved registers
(arguments and temporaries) for integer and FP registers.
- If there is a call in the interrupt handler, save/restore all
Caller saved registers (arguments and temporaries) and all FP registers.
- Emit special return instructions depending on "interrupt"
attribute type.
Based on initial patch by Zhaoshi Zheng.

Reviewers: asb

Reviewed By: asb

Subscribers: rkruppe, the_o, MartinMosbeck, brucehoult, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, mgrang, rogfer01, llvm-commits

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

llvm-svn: 338047

5 years agoMacroFusion: Fix macro fusion with ExitSU failing in top-down scheduling
Matthias Braun [Thu, 26 Jul 2018 17:43:56 +0000 (17:43 +0000)]
MacroFusion: Fix macro fusion with ExitSU failing in top-down scheduling

When fusing instructions A and B, we must add all predecessors of B as
predecessors of A to avoid instructions getting scheduling in between.

There is a special case involving ExitSU: Every other node must be
scheduled before it by design and we don't need to make this explicit in
the graph, however when fusing with a different node we need to schedule
every othere node before the fused node too and we need to make this
explicit now: This patch adds a dependency from the fused node to all
roots in the graph.

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

llvm-svn: 338046

5 years ago [RISCV] Add support for interrupt attribute
Ana Pazos [Thu, 26 Jul 2018 17:37:45 +0000 (17:37 +0000)]
 [RISCV] Add support for interrupt attribute

Summary:
Clang supports the GNU style ``__attribute__((interrupt))`` attribute  on RISCV targets.
Permissible values for this parameter are user, supervisor, and machine.
If there is no parameter, then it defaults to machine.
Reference: https://gcc.gnu.org/onlinedocs/gcc/RISC-V-Function-Attributes.html
Based on initial patch by Zhaoshi Zheng.

Reviewers: asb, aaron.ballman

Reviewed By: asb, aaron.ballman

Subscribers: rkruppe, the_o, aaron.ballman, MartinMosbeck, brucehoult, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, mgrang, rogfer01, cfe-commits

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

llvm-svn: 338045

5 years ago[DAGCombine] optimizeSetCCOfSignedTruncationCheck(): handle ule,ugt CondCodes.
Roman Lebedev [Thu, 26 Jul 2018 17:34:28 +0000 (17:34 +0000)]
[DAGCombine] optimizeSetCCOfSignedTruncationCheck(): handle ule,ugt CondCodes.

Summary:
A follow-up for D49266 / rL337166.

At least one of these cases is more canonical,
so we really do have to handle it.
https://godbolt.org/g/pkzP3X
https://rise4fun.com/Alive/pQyhZZ

We won't get to these cases with I1 being -1,
as that will be constant-folded to true or false.

I'm also not sure we actually hit the 'ule' case,
but i think the worst think that could happen is that being dead code.

Reviewers: spatel, craig.topper, RKSimon, javed.absar, efriedma

Reviewed By: spatel

Subscribers: llvm-commits

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

llvm-svn: 338044

5 years agoFix duplicate suggestions after an ambiguous command
Raphael Isemann [Thu, 26 Jul 2018 17:14:18 +0000 (17:14 +0000)]
Fix duplicate suggestions after an ambiguous command

Summary:
So far lldb is printing this when it finds an ambiguous command:
```
(lldb) g
Ambiguous command 'g'. Possible matches:
        gdb-remote
        gui
        gdb-remote
        gui
```
The duplicates come from the fact that we call the same query twice with the same parameters
and add it to the same list. This patch just removes the second query call to `GetCommandObject`.

As `GetCommandObject` is const and the name parameter is also not modified, this shouldn't break
anything else. I didn't merge the remaining if statement into the else as I think otherwise the
`if obj==nullptr do X else Y` pattern in there becomes hard to recognize.

Reviewers: davide

Reviewed By: davide

Subscribers: lldb-commits

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

llvm-svn: 338043

5 years ago[COFF] clean up global resources after completion
Rui Ueyama [Thu, 26 Jul 2018 17:11:24 +0000 (17:11 +0000)]
[COFF] clean up global resources after completion

Patch by Andrew Kelley.

Previously, running lld::coff::link() twice in the same process would
access stale pointers because of these global variables not being reset.
After this patch, lld::coff::link() can be called any number of times,
just like its ELF and MACH-O counterparts.

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

llvm-svn: 338042

5 years ago[CodeGen][ObjC] Make block copy/dispose helper functions exception-safe.
Akira Hatanaka [Thu, 26 Jul 2018 16:51:21 +0000 (16:51 +0000)]
[CodeGen][ObjC] Make block copy/dispose helper functions exception-safe.

When an exception is thrown in a block copy helper function, captured
objects that have previously been copied should be destructed or
released. Similarly, captured objects that are yet to be released should
be released when an exception is thrown in a dispose helper function.

rdar://problem/42410255

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

llvm-svn: 338041