146623 Commits

Author SHA1 Message Date
Ahmed Bougacha
1f669f9bb5 [GlobalISel][AArch64] Split out cast select tests. NFC.
And remove some redundant bitcast tests.

Also split the test functions themselves: it makes it obvious to see
what's tested where and what isn't, it makes the tests much easier to
read and manually update, and, most importantly, it makes them almost
trivial to update using tooling.  Yes, it's obnoxiously verbose, but
said tooling helps upgrade to better MIR syntax whenever available.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298222 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-19 16:12:51 +00:00
Ahmed Bougacha
32431f2d21 [GlobalISel] Move method definition to the proper file. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298221 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-19 16:12:48 +00:00
Ahmed Bougacha
e80b226a12 [CodeGen] Update hasSideEffects comment. NFC.
We used to have 3 side effect flags, but as of r222809, we only have
hasSideEffects.  Change the comment to reflect that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298220 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-19 16:12:45 +00:00
Xin Tong
15605ca567 Correct a rebase mistake.
Left out AA in jumpthreading SimplifyPartiallyRedundantLoad

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298219 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-19 15:41:46 +00:00
Xin Tong
149f09bf35 Remove unused arguments. NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298218 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-19 15:31:16 +00:00
Xin Tong
2fc03c9da3 [JumpThreading] Perform phi-translation in SimplifyPartiallyRedundantLoad.
Summary:
In case we are loading on a phi-load in SimplifyPartiallyRedundantLoad.
Try to phi translate it into incoming values in the predecessors before
we search for available loads.

This needs https://reviews.llvm.org/D30524

Reviewers: davide, sanjoy, efriedma, dberlin, rengolin

Reviewed By: dberlin

Subscribers: junbuml, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298217 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-19 15:30:53 +00:00
Xin Tong
966ca1d295 Extract FindAvailablePtrLoadStore out of FindAvailableLoadedValue. NFCI
Summary:
Extract FindAvailablePtrLoadStore out of FindAvailableLoadedValue.
Prepare for upcoming change which will do phi-translation for load on
phi pointer in jump threading SimplifyPartiallyRedundantLoad.

This is in preparation for https://reviews.llvm.org/D30543

Reviewers: efriedma, sanjoy, davide, dberlin

Reviewed By: davide

Subscribers: junbuml, davide, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298216 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-19 15:27:52 +00:00
Teresa Johnson
ad346a2a0c Enable stripping of multiple DILocation on !llvm.loop metadata
Summary:
I found that stripDebugInfo was still leaving significant amounts of
debug info due to !llvm.loop that contained DILocation after stripping.
The support for stripping debug info on !llvm.loop added in r293377 only
removes a single DILocation. Enhance that to remove all DILocation from
!llvm.loop.

Reviewers: hfinkel, aprantl, dsanders

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298213 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-19 13:54:57 +00:00
Oren Ben Simhon
c1d183262c [MIR] Test assumes x64 windows calling convention upon printing/parsing MIR output/input.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298212 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-19 13:23:20 +00:00
Benjamin Kramer
4cd123aada [MIR] Add triple to test that assumes it runs on windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298211 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-19 13:04:35 +00:00
Oren Ben Simhon
2c46aa5d72 CalleeSavedRegister was removed from MIR and is recalculated upon MIR parsing.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298210 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-19 11:18:09 +00:00
Oren Ben Simhon
5d845d793d Moving the test to x86 because other architectures do not suport regcall calling convention.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298209 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-19 08:53:42 +00:00
Oren Ben Simhon
05383dbf2b [MIR] Support Customed Register Mask and CSRs
The MIR printer dumps a string that describe the register mask of a function.
A static predefined list of register masks matches a static list of strings.
However when the register mask is not from the static predefined list, there is no descriptor string and the printer fails.
This patch adds support to custom register mask printing and dumping.
Also the list of callee saved registers (describing the registers that must be preserved for the caller) might be dynamic.
As such this data needs to be dumped and parsed back to the Machine Register Info.

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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298207 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-19 08:14:18 +00:00
Craig Topper
0a70890b84 [InstCombine] Use setHighBits/setLowBits/setBitsFrom in place of getLowBitsSet/getHighBitsSet.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298204 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-19 05:49:16 +00:00
Brian Gesiak
6efc00369e [Analysis] bitreverse(undef) returns undef
Summary:
The reverse of an artbitrary bitpattern is also an arbitrary
bitpattern.

Reviewers: trentxintong, arsenm, majnemer

Reviewed By: majnemer

Subscribers: majnemer, wdng, llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298201 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-19 04:40:42 +00:00
Daniel Berlin
27aadb1456 NewGVN: Now that we have a better verifier, we can prove that we can erase the predicateuser set each time we mark it touched
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298199 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-19 00:07:32 +00:00
Daniel Berlin
bc40428e38 NewGVN: Remove dead code (for now)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298198 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-19 00:07:27 +00:00
Craig Topper
f4d5d3972b [GVN] Fix accidental double storage of the function BasicBlock list in iterateOnFunction
Summary:
iterateOnFunction creates a ReversePostOrderTraversal object which does a post order traversal in its constructor and stores the results in an internal vector. Iteration over it just reads from the internal vector in reverse order.

The GVN code seems to be unaware of this and iterates over ReversePostOrderTraversal object and makes a copy of the vector into a local vector. (I think at one point in time we used a DFS here instead which would have required the local vector).

The net affect of this is that we have two vectors containing the basic block list. As I didn't want to expose the implementation detail of ReversePostOrderTraversal's constructor to GVN, I've changed the code to do an explicit post order traversal storing into the local vector and then reverse iterate over that.

I've also removed the reserve(256) since the ReversePostOrderTraversal wasn't doing that. I can add it back if we thinks it important. Though it seemed weird that it wasn't based on the size of the function.

Reviewers: davide, anemet, dberlin

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298191 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-18 18:24:41 +00:00
Craig Topper
99e866c1f0 [ValueTracking] Remove deadish code from computeKnownBitsAddSub.
The code assigned to KnownZero, but later code unconditionally assigned over it. I'm pretty sure the later code can handle the same cases and more equally well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298190 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-18 18:21:46 +00:00
Daniel Berlin
14281a41e1 NewGVN: Greatly enhance the ability of the NewGVN verifier to detect
issues, subsuming previous verifier.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298188 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-18 15:41:40 +00:00
Daniel Berlin
174f2f4bda NewGVN: Fix PHI evaluation bug exposed by new verifier. We were checking whether the incoming block was reachable instead of whether the specific edge was reachable
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298187 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-18 15:41:36 +00:00
Daniel Berlin
d1843415cb DebugCounters: Add API for setting/unsetting programatically.
This is required so we can re-set the counter state for verifiers,
etc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298186 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-18 15:41:13 +00:00
Matthias Braun
8ff4fe417f ExecutionDepsFix: Let targets specialize the pass; NFC
Let targets specialize the pass with the register class so we can get a
parameterless default constructor and can put the pass into the pass
registry to enable testing with -run-pass=.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298184 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-18 05:08:58 +00:00
Matthias Braun
76900ddfb6 ExecutionDepsFix: Normalize names; NFC
Normalize ExeDepsFix, execution-fix, ExecutionDependencyFix and
ExecutionDepsFix to the last one.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298183 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-18 05:05:40 +00:00
Matthias Braun
6d61e5ce5b CodeGen.cpp: Sort alphabetically; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298182 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-18 05:05:32 +00:00
Matthias Braun
6012ab1560 InitializePasses.h: Cleanup; NFC
- Sort alphabetically
- Normalize spaces

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298181 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-18 05:05:29 +00:00
Craig Topper
a48f3f3de2 [ValueTracking] Add APInt::setSignBit and use it to replace ORing with getSignBit which will malloc if the bit width is larger than 64.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298180 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-18 04:01:29 +00:00
Nirav Dave
11fdc7845a Make library calls sensitive to regparm module flag (Fixes PR3997).
Reviewers: mkuper, rnk

Subscribers: mehdi_amini, jyknight, aemerson, llvm-commits, rengolin

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298179 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-18 00:44:07 +00:00
Nirav Dave
c78bc912e4 Capitalize ArgListEntry fields. NFC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298178 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-18 00:43:57 +00:00
Bruno Cardoso Lopes
ac657a19e0 [LockFileManager] Reduce lock timeout
Go back to behavior pre-r231309 and reduce the timeout from 8 to ~1.5
min now that we have (a) PCMCache mechanism (r298165) and (b) timeout
that doesn't cause a failure, but actually build the module (r298175).

rdar://problem/30297862

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298176 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-18 00:32:34 +00:00
Stanislav Mekhanoshin
ee8b410dd7 [AMDGPU] Add address space based alias analysis pass
This is direct port of HSAILAliasAnalysis pass, just cleaned for
style and renamed.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298172 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 23:56:58 +00:00
Craig Topper
b80a9d93f1 [BuildLibCalls] emitPutChar should infer function attributes for putchar
When InstCombine calls into SimplifyLibCalls and it createa putChar calls, we don't infer the attributes. And since SimplifyLibCalls doesn't use InstCombine's IRBuilder the calls doesn't end up in the worklist on this iteration of InstCombine. So it gets picked up on the next iteration where it causes an IR change. This of course causes InstCombine to run another iteration.

So this patch just gets the attributes right the first time. We already did this for puts and some other libcalls.

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




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298171 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 23:48:02 +00:00
Sanjay Patel
b79f07b273 [x86] regenerate checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298166 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 23:04:18 +00:00
Sanjay Patel
42546f617a [x86] regenerate checks; NFC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298164 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 22:47:21 +00:00
Evgeniy Stepanov
7c45253e30 Fix docs-llvm-html build.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298163 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 22:31:13 +00:00
Jessica Paquette
e9b379b297 [Outliner] Add outliner for AArch64
This commit adds the necessary target hooks for outlining in AArch64. It also
refactors the switch statement used in `getMemOpBaseRegImmOfsWidth` into a
more general function, `getMemOpInfo`. This allows the outliner to share that
code without copying and pasting it.

The AArch64 outliner can be run using -mllvm -enable-machine-outliner, as with
the X86-64 outliner.

The test for this pass verifies that the outliner does, in fact outline
functions, fixes up the stack accesses properly, and can correctly generate a
tail call. In the future, this test should be replaced with a MIR test, so that
we can properly test immediate offset overflows in fixed-up instructions.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298162 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 22:26:55 +00:00
Eli Friedman
7347ffe269 [SCEV] Use const Loop *L instead of Loop *L. NFC
Use const pointer in the trip count and trip multiple calculations.

Patch by Huihui Zhang <huihuiz@codeaurora.org>



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298161 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 22:19:52 +00:00
Evgeniy Stepanov
a82d7906c2 [asan] Fix dead stripping of globals on Linux.
Use a combination of !associated, comdat, @llvm.compiler.used and
custom sections to allow dead stripping of globals and their asan
metadata. Sometimes.

Currently this works on LLD, which supports SHF_LINK_ORDER with
sh_link pointing to the associated section.

This also works on BFD, which seems to treat comdats as
all-or-nothing with respect to linker GC. There is a weird quirk
where the "first" global in each link is never GC-ed because of the
section symbols.

At this moment it does not work on Gold (as in the globals are never
stripped).

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298158 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 22:17:29 +00:00
Evgeniy Stepanov
df808fe215 Add !associated metadata.
This is an ELF-specific thing that adds SHF_LINK_ORDER to the global's section
pointing to the metadata argument's section. The effect of that is a reverse dependency
between sections for the linker GC.

!associated does not change the behavior of global-dce. The global
may also need to be added to llvm.compiler.used.

Since SHF_LINK_ORDER is per-section, !associated effectively enables
fdata-sections for the affected globals, the same as comdats do.

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298157 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 22:17:24 +00:00
Eli Friedman
87552d6290 [SelectionDAG] Remove redundant stores more aggressively.
Handle TokenFactors more aggressively in
SDValue::reachesChainWithoutSideEffects.  This isn't really a
very effective change anymore because of other changes to
chain handling, but it's a cheap check, and the expanded
comments are still useful.

It might be possible to loosen the hasOneUse() requirement with a
deeper analysis, but a naive implementation of that check would be
expensive.

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




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298156 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 22:15:50 +00:00
Peter Collingbourne
dcae6caf46 LTO: Work around libstdc++ version mismatch bug, see D31063 review thread.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298127 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 21:49:09 +00:00
Matt Arsenault
6cf5553d32 AMDGPU: Fix broken condition in hazard recognizer
Fixes bug 32248.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298125 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 21:36:28 +00:00
Vassil Vassilev
39984d5813 [coverity] Fix uninit variable.
Patch by John Harvey!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298122 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 20:58:08 +00:00
Matt Arsenault
a754032661 AMDGPU: Fix handling of constant phi input loop conditions
If the loop condition was an i1 phi with a constantexpr input, this
would add a loop intrinsic fed by a phi dependent on a call to
if.break in the same block. Insert the call in the loop header.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298121 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 20:52:21 +00:00
Rong Xu
6cfe632b60 [PGO] Change the internal options description. nfc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298120 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 20:51:44 +00:00
Matt Arsenault
33eb1b078c AMDGPU: Cleanup control flow intrinsics
Move backend internal intrinsics along with the rest of the
normal intrinsics, and use the Intrinsic::getDeclaration
API instead of manually constructing the type list.

It's surprising this was working before. fdiv.fast had
the wrong number of parameters. The control flow intrinsic
declaration attributes were not being applied, and
their types were inconsistent. The actual IR use types
did not match the declaration, and were closer to the
types used for the patterns. The brcond lowering
was changing the types, so introduce new nodes for those.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298119 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 20:41:45 +00:00
Sanjay Patel
d0f7ad81d5 [x86] clean up setcc with negated operand transform and add missing test; NFCI
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298118 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 20:29:40 +00:00
Reid Kleckner
64543fd3ed [X86] Emit fewer instructions to allocate >16GB stack frames
Summary:
Use this code pattern when RAX is live, instead of emitting up to 2
billion adjustments:
  pushq %rax
  movabsq +-$Offset+-8, %rax
  addq %rsp, %rax
  xchg %rax, (%rsp)
  movq (%rsp), %rsp

Try to clean this code up a bit while I'm here. In particular, hoist the
logic that handles the entire adjustment with `movabsq $imm, %rax` out
of the loop.

This negates the offset in the prologue and uses ADD because X86 only
has a two operand subtract which always subtracts from the destination
register, which can no longer be RSP.

Fixes PR31962

Reviewers: majnemer, sdardis

Subscribers: llvm-commits

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298116 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 20:25:49 +00:00
Rong Xu
6082747508 [PGO] Add omitted test cases.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298115 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 20:05:13 +00:00
Jun Bum Lim
40a6d15e7a [CodeGenPrep]Restructure promoting Ext to form ExtLoad
Summary:
Instead of just looking for a load which is mergable with Ext to form ExtLoad, trying to promote Exts as long as the cost is acceptable. This change is not a NFC as it continue promoting Exts even after finding a load during promotions; the change in arm64-codegen-prepare-extload.ll described in 2.b might show the case.
This change was motivated from D26524.  Based on this change, I will move the transformation performed in aarch64-type-promotion into CGP.

Reviewers: jmolloy, qcolombet, mcrosier, javed.absar

Reviewed By: qcolombet

Subscribers: rengolin, llvm-commits, aemerson

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298114 91177308-0d34-0410-b5e6-96231b3b80d8
2017-03-17 19:05:21 +00:00