Hans Wennborg [Wed, 29 Jan 2020 15:21:08 +0000 (16:21 +0100)]
Work around PR44697 in CrashRecoveryContext
Matt Arsenault [Tue, 28 Jan 2020 18:14:06 +0000 (13:14 -0500)]
LLT: Add changeNumElements
This is the element analog of changeElementType/changeElementSize
LLVM GN Syncbot [Wed, 29 Jan 2020 15:15:45 +0000 (15:15 +0000)]
[gn build] Port
9a08a3fab99
Connor Abbott [Wed, 29 Jan 2020 15:14:52 +0000 (16:14 +0100)]
Revert "AMDGPU: Fix handling of infinite loops in fragment shaders"
This reverts commit
0994c485e61322a04e580d83617eab547292aba2.
Connor Abbott [Wed, 29 Jan 2020 15:14:49 +0000 (16:14 +0100)]
Revert "AMDGPU: Fix AMDGPUUnifyDivergentExitNodes with no normal returns"
This reverts commit
323bfde20c5f3e63db3d6b385b394ed38542abe6.
Adam Balogh [Thu, 16 Jan 2020 15:33:05 +0000 (16:33 +0100)]
[Analyzer] Split container modeling from iterator modeling
Iterator modeling depends on container modeling,
but not vice versa. This enables the possibility
to arrange these two modeling checkers into
separate layers.
There are several advantages for doing this: the
first one is that this way we can keep the
respective modeling checkers moderately simple
and small. Furthermore, this enables creation of
checkers on container operations which only
depend on the container modeling. Thus iterator
modeling can be disabled together with the
iterator checkers if they are not needed.
Since many container operations also affect
iterators, container modeling also uses the
iterator library: it creates iterator positions
upon calling the `begin()` or `end()` method of
a containter (but propagation of the abstract
position is left to the iterator modeling),
shifts or invalidates iterators according to the
rules upon calling a container modifier and
rebinds the iterator to a new container upon
`std::move()`.
Iterator modeling propagates the abstract
iterator position, handles the relations between
iterator positions and models iterator
operations such as increments and decrements.
Differential Revision: https://reviews.llvm.org/D73547
Whitney Tsang [Wed, 29 Jan 2020 15:02:21 +0000 (15:02 +0000)]
[LoopFusion] Move instructions from FC1.Preheader to FC0.Preheader when
proven safe.
Summary:
Currently LoopFusion give up when the second loop nest preheader is
not empty. For example:
for (int i = 0; i < 100; ++i) {}
x+=1;
for (int i = 0; i < 100; ++i) {}
The above example should be safe to fuse.
This PR moves instructions in FC1 preheader (e.g. x+=1; ) to
FC0 preheader, which then LoopFusion is able to fuse them.
Reviewer: kbarton, Meinersbur, jdoerfert, dmgreen, fhahn, hfinkel,
bmahjour, etiotto
Reviewed By: jdoerfert
Subscribers: hiraditya, llvm-commits
Tag: LLVM
Differential Revision: https://reviews.llvm.org/D71821
Kazushi (Jam) Marukawa [Wed, 29 Jan 2020 14:59:29 +0000 (15:59 +0100)]
[VE] udiv/sdiv/urem/srem/mul isel patterns
Summary:
udiv/sdiv/urem/srem/mul integer isel patterns and tests.
Pretend for now that integer division were always cheap in HW.
Reviewed By: arsenm
Differential Revision: https://reviews.llvm.org/D73623
Guillaume Chatelet [Mon, 27 Jan 2020 09:55:32 +0000 (10:55 +0100)]
[libc] Fix benchmarks CMakeLists.txt
Summary:
This is a follow up on https://reviews.llvm.org/rGaba80d0734d1#886881.
`target_link_options` requires CMake>=3.13.
Reviewers: abrachet
Subscribers: mgorny, MaskRay, tschuett, libc-commits
Tags: #libc-project
Differential Revision: https://reviews.llvm.org/D73452
Nicolas Vasilache [Tue, 28 Jan 2020 18:44:37 +0000 (13:44 -0500)]
[mlir][Linalg] Introduce folding patterns to remove certain MemRefCastOp
Summary:
Canonicalization and folding patterns in StandardOps may interfere with the needs
of Linalg. This revision introduces specific foldings for dynamic memrefs that can
be proven to be static.
Very concretely:
Determines whether it is possible to fold it away in the parent Linalg op:
```mlir
%1 = memref_cast %0 : memref<8x16xf32> to memref<?x?xf32>
%2 = linalg.slice %1 ... : memref<?x?xf32> ...
// or
%1 = memref_cast %0 : memref<8x16xf32, affine_map<(i, j)->(16 * i + j)>>
to memref<?x?xf32>
linalg.generic(%1 ...) : memref<?x?xf32> ...
```
into
```mlir
%2 = linalg.slice %0 ... : memref<8x16xf32> ...
// or
linalg.generic(%0 ... : memref<8x16xf32, affine_map<(i, j)->(16 * i + j)>>
```
Reviewers: ftynse, aartbik, jsetoain, tetuante, asaadaldien
Subscribers: mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, arpith-jacob, mgester, lucyrfox, liufengdb, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73565
Matt Arsenault [Sun, 26 Jan 2020 00:34:22 +0000 (19:34 -0500)]
AMDGPU/GlobalISel: Manually select scalar f64 G_FNEG
This should be no problem to support with a pattern, but it turns out
there are just too many yaks to shave. The main problem is in the DAG
emitter, which I have no desire to sink effort into fixing.
If we had a bit to disable patterns in the DAG importer, fixing the
GlobalISelEmitter is more manageable.
Matt Arsenault [Sun, 12 Jan 2020 21:50:56 +0000 (16:50 -0500)]
Analysis: Add max recursison to isDereferenceableAndAlignedPointer
Fixes stack overflow in test/CodeGen/X86/large-gep-chain.ll when store
lowering starts adding dereferenceable flags.
Matt Arsenault [Sun, 12 Jan 2020 18:29:44 +0000 (13:29 -0500)]
GlobalISel: Lower G_WRITE_REGISTER
Mikael Holmén [Wed, 29 Jan 2020 09:32:04 +0000 (10:32 +0100)]
More fixes of implicit std::string conversions
Connor Abbott [Mon, 9 Dec 2019 11:04:00 +0000 (12:04 +0100)]
AMDGPU: Fix AMDGPUUnifyDivergentExitNodes with no normal returns
Summary:
The code was assuming in a few places that if there was only one exit
from the function that it was a normal return, which is invalid. It
could be an infinite loop, in which case we still need to insert the
usual fake edge so that the null export happens. This fixes shaders that
end with an infinite loop that discards.
Reviewers: arsenm, nhaehnle, critson
Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D71192
Connor Abbott [Wed, 27 Nov 2019 13:09:13 +0000 (14:09 +0100)]
AMDGPU: Fix handling of infinite loops in fragment shaders
Summary:
Due to the fact that kill is just a normal intrinsic, even though it's
supposed to terminate the thread, we can end up with provably infinite
loops that are actually supposed to end successfully. The
AMDGPUUnifyDivergentExitNodes pass breaks up these loops, but because
there's no obvious place to make the loop branch to, it just makes it
return immediately, which skips the exports that are supposed to happen
at the end and hangs the GPU if all the threads end up being killed.
While it would be nice if the fact that kill terminates the thread were
modeled in the IR, I think that the structurizer as-is would make a mess if we
did that when the kill is inside control flow. For now, we just add a null
export at the end to make sure that it always exports something, which fixes
the immediate problem without penalizing the more common case. This means that
we sometimes do two "done" exports when only some of the threads enter the
discard loop, but from tests the hardware seems ok with that.
This fixes dEQP-VK.graphicsfuzz.while-inside-switch with radv.
Reviewers: arsenm, nhaehnle
Subscribers: kzhuravl, jvesely, wdng, yaxunl, dstuttard, tpr, t-tye, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70781
Haojian Wu [Wed, 29 Jan 2020 11:46:51 +0000 (12:46 +0100)]
[clangd] Remove the temporary alias for clangd::DiagnosticConsumer.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73619
Sanjay Patel [Tue, 28 Jan 2020 22:06:22 +0000 (17:06 -0500)]
[InstCombine] canonicalize splat shuffle after cmp
cmp (splat V1, M), SplatC --> splat (cmp V1, SplatC'), M
As discussed in PR44588:
https://bugs.llvm.org/show_bug.cgi?id=44588
...we try harder to push shuffles after binops than after compares.
This patch handles the special (but presumably most common case) of
splat shuffles. If both operands are splats, then we can do the
comparison on the non-splat inputs followed by splat of the compare.
That should take care of the regression noted in D73411.
There's another potential fold requested in PR37463 to scalarize the
compare, but that's another patch (and it's not clear if we can do
that without the ability to undo it later):
https://bugs.llvm.org/show_bug.cgi?id=37463
Differential Revision: https://reviews.llvm.org/D73575
Sanne Wouda [Wed, 29 Jan 2020 13:07:15 +0000 (13:07 +0000)]
[AArch64] Add IR intrinsics for sq(r)dmulh_lane(q)
Summary:
Currently, sqdmulh_lane and friends from the ACLE (implemented in arm_neon.h),
are represented in LLVM IR as a (by vector) sqdmulh and a vector of (repeated)
indices, like so:
%shuffle = shufflevector <4 x i16> %v, <4 x i16> undef, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
%vqdmulh2.i = tail call <4 x i16> @llvm.aarch64.neon.sqdmulh.v4i16(<4 x i16> %a, <4 x i16> %shuffle)
When %v's values are known, the shufflevector is optimized away and we are no
longer able to select the lane variant of sqdmulh in the backend.
This defeats a (hand-coded) optimization that packs several constants into a
single vector and uses the lane intrinsics to reduce register pressure and
trade-off materialising several constants for a single vector load from the
constant pool, like so:
int16x8_t v = {2,3,4,5,6,7,8,9};
a = vqdmulh_laneq_s16(a, v, 0);
b = vqdmulh_laneq_s16(b, v, 1);
c = vqdmulh_laneq_s16(c, v, 2);
d = vqdmulh_laneq_s16(d, v, 3);
[...]
In one microbenchmark from libjpeg-turbo this accounts for a 2.5% to 4%
performance difference.
We could teach the compiler to recover the lane variants, but this would likely
require its own pass. (Alternatively, "volatile" could be used on the constants
vector, but this is a bit ugly.)
This patch instead implements the following LLVM IR intrinsics for AArch64 to
maintain the original structure through IR optmization and into instruction
selection:
- sqdmulh_lane
- sqdmulh_laneq
- sqrdmulh_lane
- sqrdmulh_laneq.
These 'lane' variants need an additional register class. The second argument
must be in the lower half of the 64-bit NEON register file, but only when
operating on i16 elements.
Note that the existing patterns for shufflevector and sqdmulh into sqdmulh_lane
(etc.) remain, so code that does not rely on NEON intrinsics to generate these
instructions is not affected.
This patch also changes clang to emit these IR intrinsics for the corresponding
NEON intrinsics (AArch64 only).
Reviewers: SjoerdMeijer, dmgreen, t.p.northover, rovka, rengolin, efriedma
Reviewed By: efriedma
Subscribers: kristof.beyls, hiraditya, jdoerfert, cfe-commits, llvm-commits
Tags: #clang, #llvm
Differential Revision: https://reviews.llvm.org/D71469
Sjoerd Meijer [Wed, 29 Jan 2020 13:19:45 +0000 (13:19 +0000)]
[MVE][MC] evaluateBranch: add missing MVE opcode
This adds some missing MVE opcodes to evaluateBranch, which results in
llvm-objdump being able to print the PC relative branch target as an
annotation.
Differential Revision: https://reviews.llvm.org/D73553
Kazushi (Jam) Marukawa [Wed, 29 Jan 2020 12:58:29 +0000 (13:58 +0100)]
[VE] Isel patterns for fp32/64 and i32/64 conversion
Summary:
fp32/64 <> signed/unsigned i32/64 conversion isel patterns and tests
(This patch depends on `fsub` implemented by https://reviews.llvm.org/D73540 )
Reviewers: arsenm, craig.topper, rengolin, k-ishizaka
Reviewed By: arsenm
Subscribers: merge_guards_bot, wdng, hiraditya, llvm-commits
Tags: #ve, #llvm
Differential Revision: https://reviews.llvm.org/D73544
Sanne Wouda [Fri, 13 Dec 2019 10:46:39 +0000 (10:46 +0000)]
Regenerate aarch64-neon-2velem.c CHECK lines
Sanne Wouda [Wed, 29 Jan 2020 13:01:24 +0000 (13:01 +0000)]
Fix clang test build
Karasev Nikita [Wed, 29 Jan 2020 12:57:27 +0000 (07:57 -0500)]
Add TagDecl AST matcher
Georgii Rymar [Wed, 29 Jan 2020 12:37:50 +0000 (15:37 +0300)]
[yaml2obj][obj2yaml] - Add lost test cases.
It is a part of https://reviews.llvm.org/D71872 which
was lost somehow during relanding after being reverted:
https://reviews.llvm.org/rG7570d387c21935b58afa67cb9ee17250e38721fa
Martin Probst [Fri, 24 Jan 2020 15:13:51 +0000 (16:13 +0100)]
clang-format: insert trailing commas into containers.
Summary:
This change adds an option to insert trailing commas into container
literals. For example, in JavaScript:
const x = [
a,
b,
^~~~~ inserted if missing.
]
This is implemented as a seperate post-processing pass after formatting
(because formatting might change whether the container literal does or
does not wrap). This keeps the code relatively simple and orthogonal,
though it has the notable drawback that the newly inserted comma is not
taken into account for formatting decisions (e.g. it might exceed the 80
char limit). To avoid exceeding the ColumnLimit, a comma is only
inserted if it fits into the limit.
Trailing comma insertion conceptually conflicts with argument
bin-packing: inserting a comma disables bin-packing, so we cannot do
both. clang-format rejects FormatStyle configurations that do both with
this change.
Reviewers: krasimir, MyDeveloperDay
Subscribers: cfe-commits
Tags: #clang
Kerry McLaughlin [Wed, 29 Jan 2020 10:40:48 +0000 (10:40 +0000)]
[AArch64][SVE] Add SVE2 intrinsics for uniform DSP operations
Summary:
Implements the following intrinsics:
- sqrdmlah, sqrdmlsh, sqrdmulh & sqdmulh
- [s|u]hadd, [s|u]hsub, [s|u]rhadd & [s|u]hsubr
- urecpe, ursqrte, sqabs & sqneg
Reviewers: sdesmalen, efriedma, dancgr, cameron.mcinally
Reviewed By: efriedma
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, cfe-commits, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73493
Sam Parker [Wed, 29 Jan 2020 11:58:41 +0000 (06:58 -0500)]
[NFC][ARM] Add test
Haojian Wu [Wed, 29 Jan 2020 10:15:47 +0000 (11:15 +0100)]
[clangd][vscode] Update lsp dependencies to pickup the progress support in LSP 3.15
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73612
Haojian Wu [Wed, 29 Jan 2020 09:12:56 +0000 (10:12 +0100)]
[clangd] Replace raw lexer code with token buffer in prepare rename.
Summary:
there is a slight behavior change in this patch:
- before: `in^t a;`, returns our internal error message (no symbol at given location)
- after: `in^t a, returns null, and client displays their message (e.g.
e.g. "the element can't be renamed" in vscode).
both are sensible according LSP, and we'd save one `rename` call in the later case.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73610
Sam McCall [Fri, 24 Jan 2020 17:21:47 +0000 (18:21 +0100)]
[clangd] Go-to-definition on 'override' jumps to overridden method(s)
Reviewers: kadircet
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73367
Sam McCall [Tue, 28 Jan 2020 11:10:50 +0000 (12:10 +0100)]
[clangd] add CODE_OWNERS
Reviewers: klimek
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, kadircet, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73537
Peter Smith [Mon, 27 Jan 2020 19:45:28 +0000 (19:45 +0000)]
[LLD][ELF][ARM] Do not substitute BL/BLX for non STT_FUNC symbols.
D73474 disabled the generation of interworking thunks for branch
relocations to non STT_FUNC symbols. This patch handles the case of BL and
BLX instructions to non STT_FUNC symbols. LLD would normally look at the
state of the caller and the callee and write a BL if the states are the
same and a BLX if the states are different.
This patch disables BL/BLX substitution when the destination symbol does
not have type STT_FUNC. This brings our behavior in line with GNU ld which
may prevent difficult to diagnose runtime errors when switching to lld.
Differential Revision: https://reviews.llvm.org/D73542
David Truby [Wed, 29 Jan 2020 11:31:25 +0000 (11:31 +0000)]
[MLIR] Add OpenMP dialect with barrier operation
Summary:
Barrier is a simple operation that takes no arguments and returns
nothing, but implies a side effect (synchronization of all threads)
Reviewers: jdoerfert
Subscribers: mgorny, guansong, mehdi_amini, rriddle, jpienaar, burmako, shauheen, antiagainst, nicolasvasilache, arpith-jacob, mgester, lucyrfox, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D72400
Kadir Cetinkaya [Wed, 29 Jan 2020 11:01:46 +0000 (12:01 +0100)]
[clangd] Get rid of delayed template parsing
Summary:
No need to pass fno-delayed-template-parsing as the opposite flag is
only passed to cc1 when abi is set to msvc. Sending as a follow-up to D73613 to
keep changes in the release branch minimal.
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73615
Kadir Cetinkaya [Wed, 29 Jan 2020 10:17:45 +0000 (11:17 +0100)]
[clangd][Hover] Make tests hermetic by setting target triplet
Summary: Fixes https://bugs.llvm.org/show_bug.cgi?id=44696
Reviewers: sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73613
Benjamin Kramer [Wed, 29 Jan 2020 11:05:01 +0000 (12:05 +0100)]
Fix an implicit conversion in clang-tidy. GCC 5 complains about it.
Momchil Velikov [Wed, 29 Jan 2020 10:38:10 +0000 (10:38 +0000)]
[ARM] Add documentation for -march= and -mfpu= command line options
Differential Revision: https://reviews.llvm.org/D73459
Kerry McLaughlin [Wed, 29 Jan 2020 09:57:30 +0000 (09:57 +0000)]
[AArch64][SVE] Add SVE2 intrinsics for pairwise arithmetic
Summary:
Implements the following intrinsics:
- addp
- smaxp, sminp, umaxp & uminp
- sadalp & uadalp
Reviewers: dancgr, efriedma, sdesmalen, c-rhodes
Reviewed By: c-rhodes
Subscribers: tschuett, kristof.beyls, hiraditya, rkruppe, psnobl, cameron.mcinally, cfe-commits, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73347
James Henderson [Tue, 28 Jan 2020 14:04:42 +0000 (14:04 +0000)]
[DebugInfo] Make most debug line prologue errors non-fatal to parsing
Many of the debug line prologue errors are not inherently fatal. In most
cases, we can make reasonable assumptions and carry on. This patch does
exactly that. In the case of length problems, the approach of "assume
stated length is correct" is taken which means the offset might need
adjusting.
This is a relanding of
b94191fe, fixing an LLD test and the LLDB build.
Reviewed by: dblaikie, labath
Differential Revision: https://reviews.llvm.org/D72158
Pavel Labath [Wed, 29 Jan 2020 10:15:20 +0000 (11:15 +0100)]
[lldb] More windows StringRef fixes
I don't have a windows build around, so I am just going by the buildbot
messages.
Kazushi (Jam) Marukawa [Wed, 29 Jan 2020 09:16:42 +0000 (10:16 +0100)]
[VE] fp32/64 fadd/fsub/fdiv/fmul isel patterns
Summary: fp32/64 fadd/fsub/fdiv/fmul isel patterns and tests.
Reviewers: arsenm, craig.topper, rengolin, k-ishizaka
Subscribers: merge_guards_bot, wdng, hiraditya, llvm-commits
Differential Revision: https://reviews.llvm.org/D73540
David Stenberg [Wed, 29 Jan 2020 08:44:02 +0000 (09:44 +0100)]
[ARM64] Debug info for structure argument missing DW_AT_location
Summary:
Prevent eliminating dbg_val due to COPY.
Fixes this
https://bugs.llvm.org/show_bug.cgi?id=40709
Patch by: Kamlesh Kumar (kamleshbhalui)
Reviewers: aprantl, dblaikie, vsk, dsanders
Reviewed By: dsanders
Subscribers: dstenb, kristof.beyls, hiraditya, llvm-commits
Tags: #debug-info, #llvm
Differential Revision: https://reviews.llvm.org/D73159
Benjamin Kramer [Wed, 29 Jan 2020 09:52:25 +0000 (10:52 +0100)]
[ASTMatchers] StringRef'ify hasName
This was just inconvenient, and we make a copy anyways.
Simon Moll [Wed, 29 Jan 2020 09:42:00 +0000 (10:42 +0100)]
[VE][fix] (more) explicit StringRef to std::string
Jay Foad [Mon, 6 Jan 2020 14:56:24 +0000 (14:56 +0000)]
[AMDGPU] Simplify DS and SM cases in getMemOperandsWithOffset
Summary:
This removes a couple of unnecessary isReg checks, now that
memOpsHaveSameBasePtr can handle FI operands, but is otherwise NFC.
Reviewers: arsenm, rampitec
Subscribers: kzhuravl, jvesely, wdng, nhaehnle, yaxunl, dstuttard, tpr, t-tye, hiraditya, kerbowa, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73485
Simon Moll [Wed, 29 Jan 2020 09:29:43 +0000 (10:29 +0100)]
[VE][fix] Explicit StringRef to std::string conversion
Adapt to changes of "[ADT] Make StringRef's std::string conversion
operator explicit" (
777180a32).
Haojian Wu [Mon, 27 Jan 2020 09:39:55 +0000 (10:39 +0100)]
[clangd] Add a symbol-name-based blacklist for rename.
Summary:
This patch adds a simple mechanism to disallow global rename
on std symbols. We might extend it to other symbols, e.g. protobuf.
Reviewers: kadircet
Subscribers: mgorny, ilya-biryukov, MaskRay, jkorous, arphaman, usaxena95, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73450
Benjamin Kramer [Wed, 29 Jan 2020 09:30:36 +0000 (10:30 +0100)]
Fix clang unnittest build with GCC 5
Pavel Labath [Wed, 29 Jan 2020 09:08:40 +0000 (10:08 +0100)]
[lldb] Fix windows build for the StringRef conversion operator change
"operator std::string()" is now explicit.
Fangrui Song [Wed, 29 Jan 2020 08:59:16 +0000 (00:59 -0800)]
[ARC] Fix ARCTargetMachine after
777180a32b6107
Sam Parker [Wed, 29 Jan 2020 08:26:11 +0000 (03:26 -0500)]
[RDA][ARM] Move functionality into RDA
Add several new helpers to RDA:
- hasLocalDefBefore
- isRegDefinedAfter
- isSafeToDefRegAt
And move two bits of logic from ARMLowOverheadLoops into RDA:
- isSafeToMove
- isSafeToRemove
Both of these have some wrappers too to make them more convienent to
use.
Differential Revision: https://reviews.llvm.org/D73460
Raphael Isemann [Wed, 29 Jan 2020 08:20:06 +0000 (09:20 +0100)]
[lldb] Don't create duplicate declarations when completing a forward declaration with a definition from another source
Summary:
I noticed this strange line in `ASTImporterDelegate::ImportDefinitionTo` which doesn't make a lot of sense:
```
to_tag->setCompleteDefinition(from_tag->isCompleteDefinition());
```
It forcibly sets the imported TagDecl to be defined if the source TagDecl was defined. This doesn't make any
sense as in this code we already forced the ASTImporter to import the definition so this should always be
a no-op.
Turns out this is hiding two bugs:
1. The way we handle forward declarations in the debug info that might be completed later is that we
import them and then mark them as having external lexical storage. This makes Clang ask for the definition
later when it needs it (at which point we hopefully have the definition around and can complete it). However,
this is currently not completing the forward decls with external storage but instead creates a duplicated decl
in the target AST which is then defined. The forward decl is kept incomplete after the import and we just
forcibly make it a definition of the record without any content with our workaround. The TestSharedLib* tests
is only passing because of this.
2. Minimal import of lambdas is broken and never imports the definition it seems. That appears to be a bug
in the ASTImporter which gives the definition of lambda's some special treatment. TestLambdas.py is actually
broken but is passing because of this workaround.
This patch fixes the first bug by forcing the ASTImporter to import to the target forward declaration. We can't
delete the workaround as the second bug is still around but that will be a follow up review for the ASTImporter.
However it will get rid of all the duplicated RecordDecls that are in our expression AST that are strangely defined
but don't have any of the fields they are supposed to have.
Reviewers: shafik, labath
Reviewed By: shafik
Subscribers: aprantl, abidh, JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D73345
Raphael Isemann [Wed, 29 Jan 2020 08:07:55 +0000 (09:07 +0100)]
[lldb] Complete return types of CXXMethodDecls to prevent crashing due to covariant return types
Summary:
Currently we crash in Clang's CodeGen when we call functions with covariant return types with this assert:
```
Assertion failed: (DD && "queried property of class with no definition"), function data, file clang/include/clang/AST/DeclCXX.h, line 433.
```
when calling `clang::CXXRecordDecl::isDerivedFrom` from the `ItaniumVTableBuilder`.
Clang seems to assume that the underlying record decls of covariant return types are already completed.
This is true during a normal Clang invocation as there the type checker will complete both decls when
checking if the overloaded function is valid (i.e., the return types are covariant).
When we minimally import our AST into the expression in LLDB we don't do this type checking (which
would complete the record decls) and we end up trying to access the invalid record decls from CodeGen
which makes us trigger the assert.
This patch just completes the underlying types of ptr/ref return types of virtual function so that the
underlying records are complete and we behave as Clang expects us to do.
Fixes rdar://
38048657
Reviewers: lhames, shafik
Reviewed By: shafik
Subscribers: abidh, JDevlieghere, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D73024
Raphael Isemann [Mon, 27 Jan 2020 20:24:39 +0000 (21:24 +0100)]
[lldb] Use CompletionRequest in REPL::CompleteCode and remove translation code to old API
Any REPL client should just move to CompletionRequest instead of relying on
the translation code from the old API, so let's remove that translation code.
Fangrui Song [Wed, 29 Jan 2020 05:18:29 +0000 (21:18 -0800)]
[X86] matchAdd: don't fold a large offset into a %rip relative address
For `ret i64 add (i64 ptrtoint (i32* @foo to i64), i64
1701208431)`,
```
X86DAGToDAGISel::matchAdd
...
// AM.setBaseReg(CurDAG->getRegister(X86::RIP, MVT::i64));
if (!matchAddressRecursively(N.getOperand(0), AM, Depth+1) &&
// Try folding offset but fail; there is a symbolic displacement, so offset cannot be too large
!matchAddressRecursively(Handle.getValue().getOperand(1), AM, Depth+1))
return false;
...
// Try again after commuting the operands.
// AM.Disp = Val; foldOffsetIntoAddress() does not know there will be a symbolic displacement
if (!matchAddressRecursively(Handle.getValue().getOperand(1), AM, Depth+1) &&
// AM.setBaseReg(CurDAG->getRegister(X86::RIP, MVT::i64));
!matchAddressRecursively(Handle.getValue().getOperand(0), AM, Depth+1))
// Succeeded! Produced leaq sym+disp(%rip),...
return false;
```
`foldOffsetIntoAddress()` currently does not know there is a symbolic
displacement and can fold a large offset.
The produced `leaq sym+disp(%rip), %rax` instruction is relocated by
an R_X86_64_PC32. If disp is large and sym+disp-rip>=2**31, there
will be a relocation overflow.
This approach is still not elegant. Unfortunately the isRIPRelative
interface is a bit clumsy. I tried several solutions and eventually
picked this one.
Differential Revision: https://reviews.llvm.org/D73606
Johannes Doerfert [Wed, 29 Jan 2020 05:51:25 +0000 (23:51 -0600)]
[Attributor][Fix] Initialize unused but loaded variable
This hopefully un-breaks:
http://lab.llvm.org:8011/builders/sanitizer-x86_64-linux-fast/builds/38333
Johannes Doerfert [Tue, 28 Jan 2020 15:46:15 +0000 (09:46 -0600)]
[Attributor] Reuse existing logic to avoid duplication
There was a TODO in AAValueConstantRangeArgument to reuse
AAArgumentFromCallSiteArguments. We now do this by allowing new States
to be build from the bestState.
Johannes Doerfert [Tue, 28 Jan 2020 15:38:07 +0000 (09:38 -0600)]
[Attributor][FIX] Treat invalidated attributes as changed
If we invalidate an attribute we need to inform all dependent ones even
if the fixpoint state is not invalid. Before we only continued
invalidation if the fixpoint state was invalid, now we signal a change
in case the fixpoint state is valid.
The test case was already included in D71620 but the problem was hiding
because it only manifested with the old PM (for that input).
Johannes Doerfert [Tue, 28 Jan 2020 04:24:32 +0000 (22:24 -0600)]
[Attributor] Modularize AANoAliasCallSiteArgument to simplify extensions
This patch modularizes the way we check for no-alias call site arguments
by putting the existing logic into helper functions. The reasoning was
not changed but special cases for readonly/readnone were added.
Johannes Doerfert [Tue, 28 Jan 2020 04:19:11 +0000 (22:19 -0600)]
[Attributor] Mark a non-defined `null` pointer as `noalias`
If `null` is not defined we cannot access it, hence the pointer is
`noalias`. While this is not helpful on it's own it simplifies later
deductions that can skip over already known `noalias` pointers in
certain situations.
Johannes Doerfert [Tue, 28 Jan 2020 17:49:59 +0000 (11:49 -0600)]
[Attributor][NFC] Remove ugly and unneeded cast
Johannes Doerfert [Tue, 28 Jan 2020 17:49:35 +0000 (11:49 -0600)]
[Attributor][NFC] Improve debug messages
Johannes Doerfert [Sun, 26 Jan 2020 08:49:58 +0000 (02:49 -0600)]
[Attributor][NFC] Internalize helper function
Eli Friedman [Wed, 29 Jan 2020 03:44:20 +0000 (19:44 -0800)]
Fix polly build after StringRef change.
Benjamin Kramer [Wed, 29 Jan 2020 02:42:02 +0000 (03:42 +0100)]
One more bugpoitn fix for GCC5
Benjamin Kramer [Wed, 29 Jan 2020 02:30:05 +0000 (03:30 +0100)]
Try harder to fix bugpoint with GCC5
Alex Lorenz [Mon, 27 Jan 2020 21:01:06 +0000 (13:01 -0800)]
[driver][Darwin] Add an -ibuiltininc flag that lets Darwin driver
include Clang builtin headers even with -nostdinc
Some projects use -nostdinc, but need to access some intrinsics files when building specific files.
The new -ibuiltininc flag lets them use this flag when compiling these files to ensure they can
find Clang's builtin headers.
The use of -nobuiltininc after the -ibuiltininc flag does not add the builtin header
search path to the list of header search paths.
Differential Revision: https://reviews.llvm.org/D73500
Benjamin Kramer [Wed, 29 Jan 2020 02:11:00 +0000 (03:11 +0100)]
Make bugpoint work with gcc5 again.
Benjamin Kramer [Wed, 29 Jan 2020 01:57:59 +0000 (02:57 +0100)]
Fix more implicit conversions. Getting closer to having clang working with gcc 5 again
Benjamin Kramer [Wed, 29 Jan 2020 01:48:15 +0000 (02:48 +0100)]
Fix conversions in clang and examples
Benjamin Kramer [Wed, 29 Jan 2020 01:19:22 +0000 (02:19 +0100)]
GCC5 buildbot made it to clang. Fix implicit conversions it found.
Nate Voorhies [Wed, 29 Jan 2020 00:07:48 +0000 (16:07 -0800)]
[NFC] Fix unused variable warning.
Reviewers: dschuff
Reviewed By: dschuff
Subscribers: hiraditya, aheejin, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D73591
Vedant Kumar [Wed, 29 Jan 2020 01:03:39 +0000 (17:03 -0800)]
[CodeExtractor] Remove stale llvm.assume calls from extracted region
During extraction, stale llvm.assume handles may be retained in the
original function. The setup is:
1) CodeExtractor unregisters assumptions in the blocks that are to be
extracted.
2) Extraction happens. There are now two functions: f1 and f1.extracted.
3) Leftover assumptions in f1 (/not/ removed as they were not in the set of
blocks to be extracted) now have affected-value llvm.assume handles in
f1.extracted.
When assumptions for a value used in f1 are looked up, ValueTracking can assert
as some of the handles are in the wrong function. To fix this, simply erase the
llvm.assume calls in the extracted function.
Alternatives include flushing the assumption cache in the original function, or
walking all values used in the original function to prune stale affected-value
handles. Both seem more expensive.
Testing: check-llvm, LNT run with -mllvm -hot-cold-split enabled
rdar://
58460728
Benjamin Kramer [Wed, 29 Jan 2020 01:12:23 +0000 (02:12 +0100)]
Another stab at making the gold plugin compile again
Jonas Devlieghere [Wed, 29 Jan 2020 01:09:49 +0000 (17:09 -0800)]
[lldb/API] Fix bogus copy assignment operator
The copy assignment operator is supposed to return the class and not
void. Fix the methods and the reproducer instrumentation macros.
Benjamin Kramer [Wed, 29 Jan 2020 01:09:24 +0000 (02:09 +0100)]
Another round of GCC5 fixes.
Sam McCall [Wed, 29 Jan 2020 01:01:42 +0000 (02:01 +0100)]
[clangd] Fix null check in FindTarget.
I've hit this stack trace a few times but don't have a good reproducer.
The code is unsafe by inspection, though.
Derek Schuff [Tue, 28 Jan 2020 21:46:03 +0000 (13:46 -0800)]
[WebAssembly] Preserve debug frame base information through register coloring
2 fixes:
Register coloring can re-assign virtual registers. When the frame base register
is colored, update the DwarfFrameBase accordingly When the frame base register
is stackified, do not attempt to encode DW_AT_frame_base as a local In the
future we will presumably want to handle this case better but for now we can
emit worse debug info rather than crashing.
Differential Revision: https://reviews.llvm.org/D73581
Benjamin Kramer [Wed, 29 Jan 2020 00:49:54 +0000 (01:49 +0100)]
Fix one round of implicit conversions found by g++5.
Nico Weber [Wed, 29 Jan 2020 00:48:31 +0000 (19:48 -0500)]
Fix clangd-xpc-test-client build after
777180a32b6107
Jonas Devlieghere [Wed, 29 Jan 2020 00:44:30 +0000 (16:44 -0800)]
[lldb/API] Implement the copy (assignment) constructor for SBLaunchInfo
Currently the constructor is compiler generated which means it doesn't
get instrumented for the reproducers.
Nico Weber [Wed, 29 Jan 2020 00:35:11 +0000 (19:35 -0500)]
Fix xpc build after
777180a32b6107
Craig Topper [Wed, 29 Jan 2020 00:13:51 +0000 (16:13 -0800)]
[X86] Use SelectionDAG::getZExtOrTrunc to simplify some code. NFCI
Craig Topper [Tue, 28 Jan 2020 23:37:22 +0000 (15:37 -0800)]
[X86] Add test case for llvm.flt.rounds
Jonas Devlieghere [Wed, 29 Jan 2020 00:13:15 +0000 (16:13 -0800)]
[lldb/API] Implement the copy (assignment) constructor for SBPlatform
Currently the constructor is compiler generated which means it doesn't
get instrumented for the reproducers.
Nico Weber [Wed, 29 Jan 2020 00:22:22 +0000 (19:22 -0500)]
Fix AVR build after
777180a32b6107
Alex Langford [Tue, 28 Jan 2020 22:44:32 +0000 (14:44 -0800)]
[lldb] Remove unused header from ValueObject.cpp
In commit
5eaf44f99f0a0a3bdfa892892b8aaca841c8dbe0 I removed the last
instance of TypeSystemClang from ValueObject, so the header is no longer
needed.
Benjamin Kramer [Wed, 29 Jan 2020 00:01:09 +0000 (01:01 +0100)]
Address implicit conversions detected by g++ 5 only.
Benjamin Kramer [Tue, 28 Jan 2020 23:49:35 +0000 (00:49 +0100)]
One more batch of things found by g++ 6
Eli Friedman [Wed, 22 Jan 2020 00:51:17 +0000 (16:51 -0800)]
[AliasAnalysis] Add missing FMRB_* enums.
Previously, the enums didn't account for all the possible cases, which
could cause misleading results (particularly for a "switch" on
FunctionModRefBehavior).
Fixes regression in polly from recent patch to add writeonly to memset.
While I'm here, also fix a few dubious uses of the FMRB_* enum values.
Differential Revision: https://reviews.llvm.org/D73154
Benjamin Kramer [Tue, 28 Jan 2020 23:42:56 +0000 (00:42 +0100)]
Fix a couple more implicit conversions that Clang doesn't diagnose.
Benjamin Kramer [Tue, 28 Jan 2020 23:29:48 +0000 (00:29 +0100)]
A bunch more implicit string conversions that my Clang didn't detect.
Nate Voorhies [Tue, 28 Jan 2020 19:11:04 +0000 (11:11 -0800)]
[NFC] Removing experimental designation for ninja in docs.
Summary:
Ninja is no longer an experimental tool, documentation changed to
reflect this.
Reviewers: nikola
Reviewed By: nikola
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D73567
Jonas Devlieghere [Tue, 28 Jan 2020 23:28:13 +0000 (15:28 -0800)]
Fix another implicit conversion in the directory watcher
Benjamin Kramer [Tue, 28 Jan 2020 23:25:44 +0000 (00:25 +0100)]
[tblgen] Fix implicit conversion only diagnosed by g++ 6
Francis Visoiu Mistrih [Tue, 28 Jan 2020 23:23:28 +0000 (15:23 -0800)]
[NFC] Fix comment typo
Jonas Devlieghere [Tue, 28 Jan 2020 23:19:17 +0000 (15:19 -0800)]
Fix more implicit conversions
Benjamin Kramer [Tue, 28 Jan 2020 23:18:16 +0000 (00:18 +0100)]
[Driver] Fix implicit conversion guarded by #ifdef _WIN32
Benjamin Kramer [Tue, 28 Jan 2020 23:17:07 +0000 (00:17 +0100)]
Fix implicit conversions in example code.