Florian Hahn [Thu, 29 Aug 2019 17:47:58 +0000 (17:47 +0000)]
[LoopUnrollAndJam] Use Lazy strategy for DTU.
We can also apply the earlier updates to the lazy DTU, instead of
applying them directly.
Reviewers: kuhar, brzycki, asbirlea, SjoerdMeijer
Reviewed By: brzycki, asbirlea, SjoerdMeijer
Differential Revision: https://reviews.llvm.org/D66918
llvm-svn: 370391
Matthew G McGovern [Thu, 29 Aug 2019 17:47:43 +0000 (17:47 +0000)]
[cmake] enable x86 libfuzzer on Windows
- recent commit https://reviews.llvm.org/D66433 enabled libfuzzer
to build on windows, this just enables the option to build as part
of the the regular build.
llvm-svn: 370390
Matt Arsenault [Thu, 29 Aug 2019 17:24:36 +0000 (17:24 +0000)]
GlobalISel: Add maskedValueIsZero and signBitIsZero to known bits
I dropped the DemandedElts since it seems to be missing from some of
the new interfaces, but not others.
llvm-svn: 370389
Matt Arsenault [Thu, 29 Aug 2019 17:24:32 +0000 (17:24 +0000)]
GlobalISel: Add known bits to InstructionSelector
AMDGPU uses this for some addressing mode selection patterns. The
analysis run itself doesn't do anything so it seems easier to just
always require this than adding a way to opt in.
llvm-svn: 370388
Jonas Devlieghere [Thu, 29 Aug 2019 17:19:00 +0000 (17:19 +0000)]
[dotest] Remove deprecated loggin through env variables.
It used to be possible to enable logging through environment variables
read by dotest. This approach is deprecated, as stated in the dotest
help output. Instead --channel should be used.
Differential revision: https://reviews.llvm.org/D66920
llvm-svn: 370387
Jonas Devlieghere [Thu, 29 Aug 2019 17:18:57 +0000 (17:18 +0000)]
[dotest] Remove the curses result formatter.
This removes the curses result formatter which appears to be broken.
Passing --curses to dotest.py screws up my terminal and doesn't run any
tests. It even crashes Python on occasion.
Differential revision: https://reviews.llvm.org/D66917
llvm-svn: 370386
Davide Italiano [Thu, 29 Aug 2019 17:14:25 +0000 (17:14 +0000)]
Revert "[TSanRuntime] Upstream thread swift race detector."
Sometimes it's easier to resolve merge conflict than arguing.
llvm-svn: 370385
Alina Sbirlea [Thu, 29 Aug 2019 17:08:13 +0000 (17:08 +0000)]
[MemorySSA & LoopPassManager] Enable MemorySSA as loop dependency. Update tests.
Summary:
I'm not planning to check this in at the moment, but feedback is very welcome, in particular how this affects performance.
The feedback obtains here will guide the next steps towards enabling this.
This patch enables the use of MemorySSA in the loop pass manager.
Passes that currently use MemorySSA:
- EarlyCSE
Passes that use MemorySSA after this patch:
- EarlyCSE
- LICM
- SimpleLoopUnswitch
Loop passes that update MemorySSA (and do not use it yet, but could use it after this patch):
- LoopInstSimplify
- LoopSimplifyCFG
- LoopUnswitch
- LoopRotate
- LoopSimplify
- LCSSA
Loop passes that do *not* update MemorySSA:
- IndVarSimplify
- LoopDelete
- LoopIdiom
- LoopSink
- LoopUnroll
- LoopInterchange
- LoopUnrollAndJam
- LoopVectorize
- LoopReroll
- IRCE
Reviewers: chandlerc, george.burgess.iv, davide, sanjoy, gberry
Subscribers: jlebar, Prazek, dmgreen, jdoerfert, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D58311
llvm-svn: 370384
Dmitri Gribenko [Thu, 29 Aug 2019 16:58:13 +0000 (16:58 +0000)]
Added 'inline' to functions defined in headers to avoid ODR violations
llvm-svn: 370383
Jessica Paquette [Thu, 29 Aug 2019 16:55:55 +0000 (16:55 +0000)]
[GlobalISel][AArch64] Select llvm.aarch64.stxr* intrinsics.
Add a GISelPredicateCode to the stxr_* PatFrags in AArch64InstrAtomics.td.
This allows us to select these intrinsics.
Differential Revision: https://reviews.llvm.org/D65779
llvm-svn: 370382
Sanjay Patel [Thu, 29 Aug 2019 16:48:00 +0000 (16:48 +0000)]
[InstCombine] add tests for bswap disguised as shuffle; NFC
Somewhat motivating case In PR43146:
https://bugs.llvm.org/show_bug.cgi?id=43146
But that's a lot more complicated.
llvm-svn: 370381
Jessica Paquette [Thu, 29 Aug 2019 16:45:19 +0000 (16:45 +0000)]
[GlobalISel][AArch64] Use a GISelPredicateCode to select llvm.aarch64.stlxr.*
Remove manual selection code for this intrinsic and use a GISelPredicateCode
instead.
This allows us to fully select this intrinsic without any tricky custom C++
matching.
Differential Revision: https://reviews.llvm.org/D65780
llvm-svn: 370380
Dmitri Gribenko [Thu, 29 Aug 2019 16:38:36 +0000 (16:38 +0000)]
Changed FrontendActionFactory::create to return a std::unique_ptr
Subscribers: jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66947
llvm-svn: 370379
Jessica Paquette [Thu, 29 Aug 2019 16:33:01 +0000 (16:33 +0000)]
[AArch64][GlobalISel] Select @llvm.aarch64.ldxr.* intrinsics
Same thing as D66897, but for ldxr.* instead. Add a GISelPredicateCode to the
ldxr_* definitions, which allows us to import them.
Add select-ldxr-intrin.mir, and update arm64-ldxr-stxr.ll.
Differential Revision: https://reviews.llvm.org/D66898
llvm-svn: 370378
Jessica Paquette [Thu, 29 Aug 2019 16:16:38 +0000 (16:16 +0000)]
[AArch64][GlobalISel] Select @llvm.aarch64.ldaxr.* intrinsics
Add a GISelPredicateCode to ldaxr_*. This allows us to import the patterns for
@llvm.aarch64.ldaxr.*, and thus select them.
Add `isLoadStoreOfNumBytes` for the GISelPredicateCode, since each of these
intrinsics involves the same check.
Add select-ldaxr-intrin.mir, and update arm64-ldxr-stxr.ll.
Differential Revision: https://reviews.llvm.org/D66897
llvm-svn: 370377
Michael Liao [Thu, 29 Aug 2019 16:12:05 +0000 (16:12 +0000)]
[SimplifyCFG] Skip sinking common lifetime markers of `alloca`.
Summary:
- Similar to the workaround in fix of PR30188, skip sinking common
lifetime markers of `alloca`. They are mostly left there after
inlining functions in branches.
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66950
llvm-svn: 370376
Jinsong Ji [Thu, 29 Aug 2019 15:38:02 +0000 (15:38 +0000)]
[PowerPC][NFC] Update fp-int-conversions-direct-moves.ll using script
Also add -ppc-asm-full-reg-names,-ppc-vsr-nums-as-vr.
llvm-svn: 370375
Pavel Labath [Thu, 29 Aug 2019 15:30:52 +0000 (15:30 +0000)]
Fix GetDIEForDeclContext so it only returns entries matching the provided context
Currently, we return all the entries such that their decl_ctx pointer >= decl_ctx provided.
Instead, we should return only the ones that decl_ctx pointer == decl_ctx provided.
Differential Revision: https://reviews.llvm.org/D66357
Patch by Guilherme Andrade <guiandrade@google.com>.
llvm-svn: 370374
Pavel Labath [Thu, 29 Aug 2019 15:21:26 +0000 (15:21 +0000)]
Remove DWARFExpression::LocationListSize
Summary:
The only reason for this function's existance is so that we could pass
the correct size into the DWARFExpression constructor. However, there is
no harm in passing the entire data extractor into the DWARFExpression,
since the same code is performing the size determination as well as the
subsequent parse. So, if we get malformed input or there's a bug in the
parser, we'd compute the wrong size anyway.
Additionally, reducing the number of entry points into the location list
parsing machinery makes it easier to switch the llvm debug_loc(lists)
parsers.
While inside, I added a couple of tests for invalid location list
handling.
Reviewers: JDevlieghere, clayborg
Subscribers: aprantl, javed.absar, kristof.beyls, lldb-commits
Differential Revision: https://reviews.llvm.org/D66789
llvm-svn: 370373
Shaurya Gupta [Thu, 29 Aug 2019 15:11:59 +0000 (15:11 +0000)]
[Clangd] NFC: Added fixme for checking for local/anonymous types for extracted parameters
llvm-svn: 370372
Haojian Wu [Thu, 29 Aug 2019 14:57:32 +0000 (14:57 +0000)]
[clangd] Update out-of-date links in readme, NFC.
llvm-svn: 370371
Roman Lebedev [Thu, 29 Aug 2019 14:46:49 +0000 (14:46 +0000)]
[NFC][SimplifyCFG] 'Safely extract low bits' pattern will also benefit from -phi-node-folding-threshold=3
This is the naive implementation of x86 BZHI/BEXTR instruction:
it takes input and bit count, and extracts low nbits up to bit width.
I.e. unlike shift it does not have any UB when nbits >= bitwidth.
Which means we don't need a while PHI here, simple select will do.
And if it's a select, it should then be trivial to fix codegen
to select it to BEXTR/BZHI.
See https://bugs.llvm.org/show_bug.cgi?id=34704
llvm-svn: 370369
Michael Kruse [Thu, 29 Aug 2019 14:42:41 +0000 (14:42 +0000)]
[ScopBuilder] Remove superfluous while loop in buildDomains. NFC.
The while loop iterating parent loop in ScopBuilder::buildDomains is
unnecessary because either L or LD are later unused, this is a simple
patch removing it.
Patch by bin.narwal <bin.narwal@gmail.com>
Differential Revision: https://reviews.llvm.org/D66698
llvm-svn: 370368
Kadir Cetinkaya [Thu, 29 Aug 2019 14:38:02 +0000 (14:38 +0000)]
[clangd][NFC] Update background-index command line description
Summary:
We didn't change this in D64019 just in case we revert it back.
Deleting it now.
Reviewers: hokein, sammccall
Subscribers: ilya-biryukov, MaskRay, jkorous, arphaman, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66943
llvm-svn: 370367
Simon Pilgrim [Thu, 29 Aug 2019 14:34:07 +0000 (14:34 +0000)]
[DAGCombine] Fix shadow variable warnings. NFCI.
llvm-svn: 370365
Pavel Labath [Thu, 29 Aug 2019 14:26:05 +0000 (14:26 +0000)]
DWARFDebugLoc: Make parsing and error reporting more robust
Summary:
While examining this class for possible use in lldb, I noticed two
things:
- it spits out parsing errors directly to stderr
- the loclists parser can incorrectly return valid location lists when
parsing malformed (truncated) data
I improve the stderr situation by making the parseOneLocationList
functions return Expected<T>s. The errors are still dumped to stderr by
their callers, so this is only a partial fix, but it is enough for my
use case, as I intend to parse the locations lists one by one.
I fix the behavior in the truncated scenario by using the newly
introduced DataExtractor Cursor API.
I also add tests for handling the error cases, as they currently have no
coverage.
Reviewers: dblaikie, JDevlieghere, probinson
Subscribers: lldb-commits, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D63591
llvm-svn: 370363
Dmitri Gribenko [Thu, 29 Aug 2019 14:21:05 +0000 (14:21 +0000)]
Removed a function declaration that doesn't have a definition
llvm-svn: 370361
Luis Marques [Thu, 29 Aug 2019 14:05:59 +0000 (14:05 +0000)]
[RISCV] Fix callee-saved-gprs.ll test ABIs
llvm-svn: 370359
Joerg Sonnenberger [Thu, 29 Aug 2019 13:22:30 +0000 (13:22 +0000)]
Allow replaceAndRecursivelySimplify to list unsimplified visitees.
This is part of D65280 and split it to avoid ABI changes on the 9.0
release branch.
llvm-svn: 370355
Simon Atanasyan [Thu, 29 Aug 2019 13:19:50 +0000 (13:19 +0000)]
[mips] Inline emitStoreWithSymOffset and emitLoadWithSymOffset methods. NFC
Both methods `MipsTargetStreamer::emitStoreWithSymOffset` and
`MipsTargetStreamer::emitLoadWithSymOffset` are almost the same and
differ argument names only. These methods are used in the single place
so it's better to inline their code and remove original methods.
llvm-svn: 370354
Simon Atanasyan [Thu, 29 Aug 2019 13:19:38 +0000 (13:19 +0000)]
[mips] Fix expanding `lw/sw $reg1, symbol($reg2)` instruction
When a "base" in the `lw/sw $reg1, symbol($reg2)` instruction is
a register and generated code is position independent, backend
does not add the "base" value to the symbol address.
```
lw $reg1, %got(symbol)($gp)
lw/sw $reg1, 0($reg1)
```
This patch fixes the bug and adds the missed `addu` instruction by
passing `BaseReg` into the `loadAndAddSymbolAddress` routine and handles
the case when the `BaseReg` is the zero register to escape redundant
`move reg, reg` instruction:
```
lw $reg1, %got(symbol)($gp)
addu $reg1, $reg1, $reg2
lw/sw $reg1, 0($reg1)
```
Differential Revision: https://reviews.llvm.org/D66894
llvm-svn: 370353
Roman Lebedev [Thu, 29 Aug 2019 12:48:04 +0000 (12:48 +0000)]
[InstSimplify] Drop leftover "division-by-zero guard" around `@llvm.umul.with.overflow` inverted overflow bit
Summary:
Now that with D65143/D65144 we've produce `@llvm.umul.with.overflow`,
and with D65147 we've flattened the CFG, we now can see that
the guard may have been there to prevent division by zero is redundant.
We can simply drop it:
```
----------------------------------------
Name: no overflow or zero
%iszero = icmp eq i4 %y, 0
%umul = smul_overflow i4 %x, %y
%umul.ov = extractvalue {i4, i1} %umul, 1
%umul.ov.not = xor %umul.ov, -1
%retval.0 = or i1 %iszero, %umul.ov.not
ret i1 %retval.0
=>
%iszero = icmp eq i4 %y, 0
%umul = smul_overflow i4 %x, %y
%umul.ov = extractvalue {i4, i1} %umul, 1
%umul.ov.not = xor %umul.ov, -1
%retval.0 = or i1 %iszero, %umul.ov.not
ret i1 %umul.ov.not
Done: 1
Optimization is correct!
```
Note that this is inverted from what we have in a previous patch,
here we are looking for the inverted overflow bit.
And that inversion is kinda problematic - given this particular
pattern we neither hoist that `not` closer to `ret` (then the pattern
would have been identical to the one without inversion,
and would have been handled by the previous patch), neither
do the opposite transform. But regardless, we should handle this too.
I've filled [[ https://bugs.llvm.org/show_bug.cgi?id=42720 | PR42720 ]].
Reviewers: nikic, spatel, xbolva00, RKSimon
Reviewed By: spatel
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65151
llvm-svn: 370351
Roman Lebedev [Thu, 29 Aug 2019 12:47:50 +0000 (12:47 +0000)]
[InstSimplify] Drop leftover "division-by-zero guard" around `@llvm.umul.with.overflow` overflow bit
Summary:
Now that with D65143/D65144 we've produce `@llvm.umul.with.overflow`,
and with D65147 we've flattened the CFG, we now can see that
the guard may have been there to prevent division by zero is redundant.
We can simply drop it:
```
----------------------------------------
Name: no overflow and not zero
%iszero = icmp ne i4 %y, 0
%umul = umul_overflow i4 %x, %y
%umul.ov = extractvalue {i4, i1} %umul, 1
%retval.0 = and i1 %iszero, %umul.ov
ret i1 %retval.0
=>
%iszero = icmp ne i4 %y, 0
%umul = umul_overflow i4 %x, %y
%umul.ov = extractvalue {i4, i1} %umul, 1
%retval.0 = and i1 %iszero, %umul.ov
ret %umul.ov
Done: 1
Optimization is correct!
```
Reviewers: nikic, spatel, xbolva00
Reviewed By: spatel
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65150
llvm-svn: 370350
Roman Lebedev [Thu, 29 Aug 2019 12:47:34 +0000 (12:47 +0000)]
[SimplifyCFG] FoldTwoEntryPHINode(): don't bailout on i1 PHI's if we can hoist a 'not' from incoming values
Summary:
As it can be seen in the tests in D65143/D65144, even though we have formed an '@llvm.umul.with.overflow'
and got rid of potential for division-by-zero, the control flow remains, we still have that branch.
We have this condition:
```
// Don't fold i1 branches on PHIs which contain binary operators
// These can often be turned into switches and other things.
if (PN->getType()->isIntegerTy(1) &&
(isa<BinaryOperator>(PN->getIncomingValue(0)) ||
isa<BinaryOperator>(PN->getIncomingValue(1)) ||
isa<BinaryOperator>(IfCond)))
return false;
```
which was added back in rL121764 to help with `select` formation i think?
That check prevents us to flatten the CFG here, even though we know
we no longer need that guard and will be able to drop everything
but the '@llvm.umul.with.overflow' + `not`.
As it can be seen from tests, we end here because the `not` is being
sinked into the PHI's incoming values by InstCombine,
so we can't workaround this by hoisting it to after PHI.
Thus i suggest that we relax that check to not bailout if we'd get to hoist the `not`.
Reviewers: craig.topper, spatel, fhahn, nikic
Reviewed By: spatel
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65147
llvm-svn: 370349
Roman Lebedev [Thu, 29 Aug 2019 12:47:20 +0000 (12:47 +0000)]
[InstCombine] Fold '((%x * %y) u/ %x) != %y' to '@llvm.umul.with.overflow' + overflow bit extraction
Summary:
`((%x * %y) u/ %x) != %y` is one of (3?) common ways to check that
some unsigned multiplication (will not) overflow.
Currently, we don't catch it. We could:
```
$ /repositories/alive2/build-Clang-unknown/alive -root-only ~/llvm-patch1.ll
Processing /home/lebedevri/llvm-patch1.ll..
----------------------------------------
Name: no overflow
%o0 = mul i4 %y, %x
%o1 = udiv i4 %o0, %x
%r = icmp ne i4 %o1, %y
ret i1 %r
=>
%n0 = umul_overflow i4 %x, %y
%o0 = extractvalue {i4, i1} %n0, 0
%o1 = udiv %o0, %x
%r = extractvalue {i4, i1} %n0, 1
ret %r
Done: 1
Optimization is correct!
----------------------------------------
Name: no overflow
%o0 = mul i4 %y, %x
%o1 = udiv i4 %o0, %x
%r = icmp eq i4 %o1, %y
ret i1 %r
=>
%n0 = umul_overflow i4 %x, %y
%o0 = extractvalue {i4, i1} %n0, 0
%o1 = udiv %o0, %x
%n1 = extractvalue {i4, i1} %n0, 1
%r = xor %n1, -1
ret i1 %r
Done: 1
Optimization is correct!
```
Reviewers: nikic, spatel, efriedma, xbolva00, RKSimon
Reviewed By: nikic
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65144
llvm-svn: 370348
Roman Lebedev [Thu, 29 Aug 2019 12:47:08 +0000 (12:47 +0000)]
[InstCombine] Fold '(-1 u/ %x) u< %y' to '@llvm.umul.with.overflow' + overflow bit extraction
Summary:
`(-1 u/ %x) u< %y` is one of (3?) common ways to check that
some unsigned multiplication (will not) overflow.
Currently, we don't catch it. We could:
```
----------------------------------------
Name: no overflow
%o0 = udiv i4 -1, %x
%r = icmp ult i4 %o0, %y
=>
%o0 = udiv i4 -1, %x
%n0 = umul_overflow i4 %x, %y
%r = extractvalue {i4, i1} %n0, 1
Done: 1
Optimization is correct!
----------------------------------------
Name: no overflow, swapped
%o0 = udiv i4 -1, %x
%r = icmp ugt i4 %y, %o0
=>
%o0 = udiv i4 -1, %x
%n0 = umul_overflow i4 %x, %y
%r = extractvalue {i4, i1} %n0, 1
Done: 1
Optimization is correct!
----------------------------------------
Name: overflow
%o0 = udiv i4 -1, %x
%r = icmp uge i4 %o0, %y
=>
%o0 = udiv i4 -1, %x
%n0 = umul_overflow i4 %x, %y
%n1 = extractvalue {i4, i1} %n0, 1
%r = xor %n1, -1
Done: 1
Optimization is correct!
----------------------------------------
Name: overflow
%o0 = udiv i4 -1, %x
%r = icmp ule i4 %y, %o0
=>
%o0 = udiv i4 -1, %x
%n0 = umul_overflow i4 %x, %y
%n1 = extractvalue {i4, i1} %n0, 1
%r = xor %n1, -1
Done: 1
Optimization is correct!
```
As it can be observed from tests, while simply forming the `@llvm.umul.with.overflow`
is easy, if we were looking for the inverted answer, then more work needs to be done
to cleanup the now-pointless control-flow that was guarding against division-by-zero.
This is being addressed in follow-up patches.
Reviewers: nikic, spatel, efriedma, xbolva00, RKSimon
Reviewed By: nikic, xbolva00
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65143
llvm-svn: 370347
Simon Pilgrim [Thu, 29 Aug 2019 12:41:19 +0000 (12:41 +0000)]
Fix variable ‘IsInitCapturePack’ set but not used warning. NFCI.
llvm-svn: 370345
Simon Pilgrim [Thu, 29 Aug 2019 12:37:02 +0000 (12:37 +0000)]
Fix MSVC "not all control paths return a value" warning. NFCI.
llvm-svn: 370343
Dmitri Gribenko [Thu, 29 Aug 2019 12:17:21 +0000 (12:17 +0000)]
Removed `AnyFunctionDecl`, it is unused.
llvm-svn: 370341
Dmitri Gribenko [Thu, 29 Aug 2019 12:10:15 +0000 (12:10 +0000)]
Removed two function declarations that don't have definitions
llvm-svn: 370340
Roman Lebedev [Thu, 29 Aug 2019 11:50:30 +0000 (11:50 +0000)]
[CostModel] Model all `extractvalue`s as free.
Summary:
As disscussed in https://reviews.llvm.org/D65148#
1606412,
`extractvalue` don't actually generate any code,
so we should treat them as free.
Reviewers: craig.topper, RKSimon, jnspaulsson, greened, asb, t.p.northover, jmolloy, dmgreen
Reviewed By: jmolloy
Subscribers: javed.absar, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66098
llvm-svn: 370339
Dmitri Gribenko [Thu, 29 Aug 2019 11:47:34 +0000 (11:47 +0000)]
[Index] Added a ShouldSkipFunctionBody callback to libIndex, and refactored clients to use it instead of inventing their own solution
Subscribers: jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66879
llvm-svn: 370338
Dmitri Gribenko [Thu, 29 Aug 2019 11:43:05 +0000 (11:43 +0000)]
[Index] Stopped wrapping FrontendActions in libIndex and its users
Exposed a new function, createIndexingASTConsumer, that creates an
ASTConsumer. ASTConsumers compose well.
Removed wrapping functionality from createIndexingAction.
llvm-svn: 370337
Dmitri Gribenko [Thu, 29 Aug 2019 11:38:43 +0000 (11:38 +0000)]
[Index] Moved the IndexDataConsumer::finish call into the IndexASTConsumer from IndexAction
Doing so removes the last reason to expose a FrontendAction from
libIndex.
llvm-svn: 370336
Alexander Potapenko [Thu, 29 Aug 2019 11:21:41 +0000 (11:21 +0000)]
[CodeGen]: don't treat structures returned in registers as memory inputs
Summary:
The "=r" output constraint for a structure variable passed to inline asm
shouldn't be converted to "=*r", as this changes the asm directive
semantics and prevents DSE optimizations.
Instead, preserve the constraints and return such structures as integers
of corresponding size, which are converted back to structures when
storing the result.
Fixes PR42672.
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D65234
llvm-svn: 370335
Jeremy Morse [Thu, 29 Aug 2019 11:20:54 +0000 (11:20 +0000)]
[DebugInfo] LiveDebugValues: correctly discriminate kinds of variable locations
The missing line added by this patch ensures that only spilt variable
locations are candidates for being restored from the stack. Otherwise,
register or constant-value information can be interpreted as a spill
location, through a union.
The added regression test replicates a scenario where this occurs: the
stack load from [rsp] causes the register-location DBG_VALUE to be
"restored" to rsi, when it should be left alone. See PR43058 for details.
Un x-fail a test that was suffering from this from a previous patch.
Differential Revision: https://reviews.llvm.org/D66895
llvm-svn: 370334
Simon Pilgrim [Thu, 29 Aug 2019 11:18:53 +0000 (11:18 +0000)]
Fix signed/unsigned comparison warning. NFCI.
llvm-svn: 370333
Simon Pilgrim [Thu, 29 Aug 2019 11:16:32 +0000 (11:16 +0000)]
Fix shadow variable warning. NFCI.
llvm-svn: 370332
George Rimar [Thu, 29 Aug 2019 10:58:47 +0000 (10:58 +0000)]
[yaml2obj] - Allow placing local symbols after globals.
This allows us to produce broken binaries with local
symbols placed after global in '.dynsym'/'.symtab'
Also, simplifies the code.
Differential revision: https://reviews.llvm.org/D66799
llvm-svn: 370331
George Rimar [Thu, 29 Aug 2019 10:55:57 +0000 (10:55 +0000)]
[llvm-readobj/llvm-readelf] - Report a proper warning when dumping a broken dynamic relocation.
When we have a dynamic relocation with a broken symbol's st_name,
tools report a useless error: "Invalid data was encountered while parsing the file".
After this change we report a warning + "<corrupt>" as a symbol name.
Differential revision: https://reviews.llvm.org/D66734
llvm-svn: 370330
David Green [Thu, 29 Aug 2019 10:54:35 +0000 (10:54 +0000)]
[ARM] MVE Masked loads and stores
Masked loads and store fit naturally with MVE, the instructions being easily
predicated. This adds lowering for the simple cases of masked loads and stores.
It does not yet deal with widening/narrowing or pre/post inc.
The llvm masked load intrinsic will accept a "passthru" value, dictating the
values used for the zero masked lanes. In MVE the instructions write 0 to the
zero predicated lanes, so we need to match a passthru that isn't 0 (or undef)
with a select instruction to pull in the correct data after the load.
We also need to do something with unaligned loads/stores. Currently this uses a
similar method used in big endian, using an VLDRB.8 (and potentially a VREV in
BE). This does mean that the predicate mask is converted from, for example, a
v4i1 to a v16i1. The VLDR instructions are defined as using the first bit of
the relevant mask lane, so this could potentially load different results if the
predicate is little odd. As the input is a v4i1 however, I believe this is OK
and all the bits required should be set in the predicate, making the VLDRB.8
load the same data.
Differential Revision: https://reviews.llvm.org/D66534
llvm-svn: 370329
Jeremy Morse [Thu, 29 Aug 2019 10:53:29 +0000 (10:53 +0000)]
[DebugInfo] LiveDebugValues should always revisit backedges if it skips them
The "join" method in LiveDebugValues does not attempt to join unseen
predecessor blocks if their out-locations aren't yet initialized, instead
the block should be re-visited later to see if any locations have changed
validity. However, because the set of blocks were all being "process"'d
once before "join" saw them, that logic in "join" was actually ignoring
legitimate out-locations on the first pass through. This meant that some
invalidated locations were not removed from the head of loops, allowing
illegal locations to persist.
Fix this by removing the run of "process" before the main join/process loop
in ExtendRanges. Now the unseen predecessors that "join" skips truly are
uninitialized, and we come back to the block at a later time to re-run
"join", see the @baz function added.
This also fixes another fault where stack/register transfers in the entry
block (or any other before-any-loop-block) had their tranfers initially
ignored, and were then never revisited. The MIR test added tests for this
behaviour.
XFail a test that exposes another bug; a fix for this is coming in D66895.
Differential Revision: https://reviews.llvm.org/D66663
llvm-svn: 370328
Roman Lebedev [Thu, 29 Aug 2019 10:50:09 +0000 (10:50 +0000)]
[X86][CodeGen][NFC] Delay `combineIncDecVector()` from DAGCombine to X86DAGToDAGISel
Summary:
We were previously doing it in DAGCombine.
But we also want to do `sub %x, C` -> `add %x, (sub 0, C)` for vectors in DAGCombine.
So if we had `sub %x, -1`, we'll transform it to `add %x, 1`,
which `combineIncDecVector()` will immediately transform back into `sub %x, -1`,
and here we go again...
I've marked this as NFC since not a single test changes,
but since that 'changes' DAGCombine, probably this isn't fully NFC.
Reviewers: RKSimon, craig.topper, spatel
Reviewed By: craig.topper
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D62327
llvm-svn: 370327
Amaury Sechet [Thu, 29 Aug 2019 10:35:51 +0000 (10:35 +0000)]
[DAGCombiner] (insert_vector_elt (vector_shuffle X, Y), (extract_vector_elt X, N), IdxC) -> (vector_shuffle X, Y)
Summary: This is beneficial when the shuffle is only used once and end up being generated in a few places when some node is combined into a shuffle.
Reviewers: craig.topper, efriedma, RKSimon, lebedev.ri
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66718
llvm-svn: 370326
David Green [Thu, 29 Aug 2019 10:32:12 +0000 (10:32 +0000)]
[ARM] Masked load and store and predicate tests. NFC
llvm-svn: 370325
Roman Lebedev [Thu, 29 Aug 2019 10:26:23 +0000 (10:26 +0000)]
[InstCombine] Shift amount reassociation in bittest: trunc-of-lshr (PR42399)
Summary:
Finally, the fold i was looking forward to :)
The legality check is muddy, i doubt i've groked the full generalization,
but it handles all the cases i care about, and can come up with:
https://rise4fun.com/Alive/26j
I.e. we can perform the fold if **any** of the following is true:
* The shift amount is either zero or one less than widest bitwidth
* Either of the values being shifted has at most lowest bit set
* The value that is being shifted by `shl` (which is not truncated) should have no less leading zeros than the total shift amount;
* The value that is being shifted by `lshr` (which **is** truncated) should have no less leading zeros than the widest bit width minus total shift amount minus one
I strongly suspect there is some better generalization, but i'm not aware of it as of right now.
For now i also avoided using actual `computeKnownBits()`, but restricted it to constants.
Reviewers: spatel, nikic, xbolva00
Reviewed By: spatel
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66383
llvm-svn: 370324
Dmitri Gribenko [Thu, 29 Aug 2019 10:23:29 +0000 (10:23 +0000)]
[Index] Create PP callbacks in the ASTConsumer
Doing so removes one reason to create a custom FrontendAction.
FrontendActions are not desirable because they are difficult to compose.
ASTConsumers are much easier to compose.
llvm-svn: 370323
Sven van Haastregt [Thu, 29 Aug 2019 10:21:06 +0000 (10:21 +0000)]
[OpenCL] Fix diagnosing enqueue_kernel call with too few args
The err_typecheck_call_too_few_args diagnostic takes arguments, but
none were provided causing clang to crash when attempting to diagnose
an enqueue_kernel call with too few arguments.
Fixes llvm.org/PR42045
Differential Revision: https://reviews.llvm.org/D66883
llvm-svn: 370322
Dmitri Gribenko [Thu, 29 Aug 2019 10:16:41 +0000 (10:16 +0000)]
[Index] Marked a bunch of classes 'final'
This file defines multiple inheritance hierarchies and 'final' helps
with readability.
llvm-svn: 370321
Simon Pilgrim [Thu, 29 Aug 2019 10:11:34 +0000 (10:11 +0000)]
LegalizeSetCCCondCode - Reduce scope of NeedSwap to fix cppcheck warning. NFCI.
No need for this to be defined outside the only switch case its used in.
llvm-svn: 370320
Simon Pilgrim [Thu, 29 Aug 2019 10:08:45 +0000 (10:08 +0000)]
Fix variable set but no used warnings on NDEBUG builds. NFCI.
llvm-svn: 370319
Simon Pilgrim [Thu, 29 Aug 2019 09:58:47 +0000 (09:58 +0000)]
Fix variable set but no used warning on NDEBUG builds. NFCI.
llvm-svn: 370317
Raphael Isemann [Thu, 29 Aug 2019 09:57:02 +0000 (09:57 +0000)]
[lldb][NFC] Try fixing TestCompletion.py on Windows
llvm-svn: 370316
Raphael Isemann [Thu, 29 Aug 2019 09:39:33 +0000 (09:39 +0000)]
[lldb][NFC] Also test operator new/new[]/delete/delete[]/comma/addr-of
llvm-svn: 370315
Adam Balogh [Thu, 29 Aug 2019 09:35:47 +0000 (09:35 +0000)]
[Analyzer] Iterator Checkers - Make range errors and invalidated access fatal
Range errors (dereferencing or incrementing the past-the-end iterator or
decrementing the iterator of the first element of the range) and access of
invalidated iterators lead to undefined behavior. There is no point to
continue the analysis after such an error on the same execution path, but
terminate it by a sink node (fatal error). This also improves the
performance and helps avoiding double reports (e.g. in case of nested
iterators).
Differential Revision: https://reviews.llvm.org/D62893
llvm-svn: 370314
Martin Storsjo [Thu, 29 Aug 2019 09:00:14 +0000 (09:00 +0000)]
[COFF] Add a ResourceSectionRef method for getting the data entry, print it in llvm-readobj
Differential Revision: https://reviews.llvm.org/D66819
llvm-svn: 370311
Martin Storsjo [Thu, 29 Aug 2019 08:59:56 +0000 (08:59 +0000)]
[COFF] Add a bounds checking helper for iterating a coff_resource_dir_table
Instead of blindly incrementing pointers in llvm-readobj, use this
helper, which does bounds checking against the available section
data.
Differential Revision: https://reviews.llvm.org/D66818
llvm-svn: 370310
Martin Storsjo [Thu, 29 Aug 2019 08:59:41 +0000 (08:59 +0000)]
[COFF] Fix error handling in ResourceSectionRef
Previously, the expression (Reader.readFoo()) was expanded twice,
triggering asserts as one of the Error types ends up not checked
(and as it was expanded twice, the method would end up called twice
if it failed first).
Differential Revision: https://reviews.llvm.org/D66817
llvm-svn: 370309
Martin Storsjo [Thu, 29 Aug 2019 08:59:31 +0000 (08:59 +0000)]
[llvm-readobj] Print the resource type textually for .res files
This already is done when dumping resources from coff objects.
Differential Revision: https://reviews.llvm.org/D66816
llvm-svn: 370308
Martin Storsjo [Thu, 29 Aug 2019 08:59:05 +0000 (08:59 +0000)]
[llvm-readobj] Remove a leftover string trim operation. NFC.
This became unnecessary in SVN r359153.
Differential Revision: https://reviews.llvm.org/D66815
llvm-svn: 370307
Johan Vikstrom [Thu, 29 Aug 2019 08:40:17 +0000 (08:40 +0000)]
[clangd] Update themeRuleMatcher when color theme changes in vscode extension.
Summary:
Add event listener that listens to configuration changes and reloads the ThemeRuleMatcher when the theme changes.
Right now it will not recolor the files, depends on the colorizer CL for that.
Reviewers: hokein, ilya-biryukov
Subscribers: MaskRay, jkorous, arphaman, kadircet, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66406
llvm-svn: 370305
Sam McCall [Thu, 29 Aug 2019 08:20:48 +0000 (08:20 +0000)]
Reland "[clangd] Migrate last tweak tests to TweakTesting.h and remove old helpers. NFC"
This reverts commit
3dcf55aa45bad800533b36b70a14ebeb2b84e219, and avoids
use of multiline raw strings in macro calls.
llvm-svn: 370304
Sylvestre Ledru [Thu, 29 Aug 2019 07:20:08 +0000 (07:20 +0000)]
use https for llvm.org in the doc
llvm-svn: 370303
Sylvestre Ledru [Thu, 29 Aug 2019 07:19:14 +0000 (07:19 +0000)]
fix the bugzilla url
llvm-svn: 370302
Sylvestre Ledru [Thu, 29 Aug 2019 07:14:09 +0000 (07:14 +0000)]
Provide a real link to the doc and remove old information
llvm-svn: 370301
Anton Afanasyev [Thu, 29 Aug 2019 06:49:05 +0000 (06:49 +0000)]
[Test][Time profiler] Fix test for python3
Summary:
Fix test checking time profiler generates correct tracing json-file.
`filter` works differently for python2 and python3, so unifying this.
Reviewers: mgehre, nathanchance
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66873
llvm-svn: 370300
Craig Topper [Thu, 29 Aug 2019 06:36:16 +0000 (06:36 +0000)]
[X86] Remove isel patterns with X86VBroadcast+scalar_to_vector+load.
The DAG should have these as X86VBroadcast+load.
llvm-svn: 370299
Dmitri Gribenko [Thu, 29 Aug 2019 06:30:12 +0000 (06:30 +0000)]
Removed dead code from clang/AST/NSAPI.h
Subscribers: cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66884
llvm-svn: 370298
Pengfei Wang [Thu, 29 Aug 2019 06:18:34 +0000 (06:18 +0000)]
[x86] Adding support for some missing intrinsics: _mm512_cvtsi512_si32
Summary:
Adding support for some missing intrinsics:
_mm512_cvtsi512_si32
Reviewers: craig.topper, pengfei, LuoYuanke, spatel, RKSimon
Reviewed By: craig.topper
Subscribers: llvm-commits
Patch by Bing Yu (yubing)
Differential Revision: https://reviews.llvm.org/D66785
llvm-svn: 370297
Craig Topper [Thu, 29 Aug 2019 06:02:11 +0000 (06:02 +0000)]
[X86] Remove some unneeded X86VBroadcast isel patterns that have larger than 128 bit input types.
We should always be shrinking the input to 128 bits or smaller
when the node is created.
llvm-svn: 370296
Hideto Ueno [Thu, 29 Aug 2019 05:52:00 +0000 (05:52 +0000)]
[Attributor] Deduce "noalias" attribute
Summary:
This patch adds very basic deduction for noalias.
Reviewers: jdoerfert, sstefan1
Reviewed By: jdoerfert
Tags: LLVM
Differential Revision: https://reviews.llvm.org/D66207
llvm-svn: 370295
Craig Topper [Thu, 29 Aug 2019 05:48:48 +0000 (05:48 +0000)]
[X86] Add a DAG combine to combine INSERTPS and VBROADCAST of a scalar load. Remove corresponding isel patterns.
We had an isel pattern to perform this, but its better to
do it in DAG combine as a simplification. This also fixes the lack
of patterns for AVX512 targets.
llvm-svn: 370294
Craig Topper [Thu, 29 Aug 2019 05:13:56 +0000 (05:13 +0000)]
[X86] Make inline assembly 'x' and 'v' constraints work for f128.
Including a type legalizer fix to make bitcast operand promotion
work correctly when getSoftenedFloat returns f128 instead of i128.
Fixes PR43157
llvm-svn: 370293
Florian Hahn [Thu, 29 Aug 2019 04:26:29 +0000 (04:26 +0000)]
[LoopUnroll] Use Lazy strategy for DTU used for MergeBlockIntoPredecessor.
We do not access the DT in the loop, so we do not have to apply updates
eagerly. We can apply them lazyly and flush them after we are done
merging blocks.
As follow-up work, we might be able to use the DTU above as well,
instead of manually updating the DT.
This brings the example from PR43134 from ~100s to ~4s for a relase +
assertions build on my machine.
Reviewers: efriedma, kuhar, asbirlea, brzycki
Reviewed By: kuhar, brzycki
Differential Revision: https://reviews.llvm.org/D66911
llvm-svn: 370292
Vitaly Buka [Thu, 29 Aug 2019 02:36:48 +0000 (02:36 +0000)]
[ObjectYAML] Fix lifetime issue in dumpDebugLines
Subscribers: llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D66901
llvm-svn: 370289
Vitaly Buka [Thu, 29 Aug 2019 02:02:03 +0000 (02:02 +0000)]
[sanitizer] Support monorepo layout in symbolizer build script
llvm-svn: 370288
Davide Italiano [Thu, 29 Aug 2019 01:45:10 +0000 (01:45 +0000)]
[python] remove testsuite vestiges.
llvm-svn: 370287
Davide Italiano [Thu, 29 Aug 2019 01:39:26 +0000 (01:39 +0000)]
[TSanRuntime] Upstream thread swift race detector.
Summary:
This is self-contained, and doesn't need anything in the
compiler to work. Mainly to reduce the diff between upstream
and downstream.
Patch by Kuba Mracek!
Reviewers: kubamracek
Subscribers: lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D66915
llvm-svn: 370286
Johannes Doerfert [Thu, 29 Aug 2019 01:29:44 +0000 (01:29 +0000)]
[Attributor] Improve messages in iteration verify mode
When we now verify the iteration count we will see the actual count
and the expected count before the assertion is triggered.
llvm-svn: 370285
Johannes Doerfert [Thu, 29 Aug 2019 01:28:30 +0000 (01:28 +0000)]
[Attributor][NFC] Add const to map key
llvm-svn: 370284
Johannes Doerfert [Thu, 29 Aug 2019 01:26:58 +0000 (01:26 +0000)]
[Attributor][Fix] Indicate change correctly
llvm-svn: 370283
Johannes Doerfert [Thu, 29 Aug 2019 01:26:09 +0000 (01:26 +0000)]
[Attributor] Fix typo
llvm-svn: 370282
Matt Arsenault [Thu, 29 Aug 2019 01:13:47 +0000 (01:13 +0000)]
AMDGPU: Don't use frame virtual registers
SGPR spills aren't really handled after SILowerSGPRSpills. In order to
directly control what happens if the scavenger needs to spill, the
scavenger needs to be used directly. There is an alternative to
spilling in these contexts anyway since the frame register can be
increment and restored.
This does present another possible issue if spilling is needed for the
unused carry out if an add is needed. I think this can be avoided by
using a scalar add (although that clobbers SCC, which happens anyway).
llvm-svn: 370281
Matt Arsenault [Thu, 29 Aug 2019 01:13:41 +0000 (01:13 +0000)]
GlobalISel/TableGen: Handle setcc patterns
This is a special case because one node maps to two different G_
instructions, and the operand order is changed.
This mostly enables G_FCMP for AMDPGPU. G_ICMP is still manually
selected for now since it has the SALU and VALU complication to deal
with.
llvm-svn: 370280
Richard Trieu [Thu, 29 Aug 2019 00:46:57 +0000 (00:46 +0000)]
Add requirement to test.
-debug-only option for llc is only available in debug builds so
"REQUIRES: asserts" is needed in the tes.
llvm-svn: 370279
Jonas Devlieghere [Wed, 28 Aug 2019 23:54:23 +0000 (23:54 +0000)]
[dotest] Make dotest.py invocation repeatable
This removes support for reading the LLDB_TEST_ARGUMENTS environment
variable and instead requires all arguments to be specified as part of
the invocation. This ensures that dotest.py invocations are easily
repeatable.
Differential revision: https://reviews.llvm.org/D66912
llvm-svn: 370278
Vitaly Buka [Wed, 28 Aug 2019 23:52:21 +0000 (23:52 +0000)]
[sanitizer] Simplify COMPILER_RT setup in lint script
llvm-svn: 370277
Craig Topper [Wed, 28 Aug 2019 23:45:10 +0000 (23:45 +0000)]
[X86] Fix a couple isel patterns to not shrink a volatile load.
Also add a FIXME because I'm not sure why these patterns exist. Looks like a missing combine.
And another FIXME because the AVX512 equivalent one of the patterns is missing.
llvm-svn: 370276
Shiva Chen [Wed, 28 Aug 2019 23:40:37 +0000 (23:40 +0000)]
[RISCV] Avoid generating AssertZext for LP64 ABI when lowering floating LibCall
The patch fixed the issue that RV64 didn't clear the upper bits
when return complex floating value with lp64 ABI.
float _Complex
complex_add(float _Complex a, float _Complex b)
{
return a + b;
}
RealResult = zero_extend(RealA + RealB)
ImageResult = ImageA + ImageB
Return (RealResult | (ImageResult << 32))
The patch introduces shouldExtendTypeInLibCall target hook to suppress
the AssertZext generation when lowering floating LibCall.
Thanks to Eli's comments from the Bugzilla
https://bugs.llvm.org/show_bug.cgi?id=42820
Differential Revision: https://reviews.llvm.org/D65497
llvm-svn: 370275
Volodymyr Sapsai [Wed, 28 Aug 2019 23:31:32 +0000 (23:31 +0000)]
[Modules] Fix rebuilding an updated module for each of its consumers.
Marking a module for a rebuild when its signature differs from the
expected one causes redundant module rebuilds for incremental builds.
When a module is updated, its signature changes. But its consumers still
have the old signature and loading them will result in signature
mismatches. It will correctly cause the rebuilds for the consumers but
we don't need to rebuild the common module for each of them as it is
already up to date.
In practice this bug causes longer build times. We are doing more work
than required and only a single process can build a module, so parallel
builds degrade to a single-process mode where extra processes are just
waiting on a file lock.
Fix by not marking a module dependency for a rebuild on signature
mismatch. We'll check if it is up to date when we load it.
rdar://problem/
50212358
Reviewers: dexonsmith, bruno, rsmith
Reviewed By: dexonsmith, bruno
Subscribers: jkorous, ributzka, cfe-commits, aprantl
Differential Revision: https://reviews.llvm.org/D66907
llvm-svn: 370274