summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
Commit message (Collapse)AuthorAgeFilesLines
...
* [Attributor][FIX] Make "known" and "assumed" liveness explicitJohannes Doerfert2019-11-021-2/+2
| | | | | | | | We did merge "known" and "assumed" liveness information into a single set which caused various kinds of problems, especially because we did not properly record when something was actually known. With this patch we properly track the "known" bit and distinguish dead ends we know from the ones we still need to explore in future updates.
* [Attributor] `willreturn` + `noreturn` = UBJohannes Doerfert2019-11-023-5/+15
| | | | | | | | | | | We gave up on `noreturn` if `willreturn` was known for a while but we now again try to always derive `noreturn`. This is useful because a function that is `noreturn` + `willreturn` is basically dead as executing it would lead to undefined behavior (UB). This came up in the IPConstantProp cases where a function only contained a unreachable but was not marked `noreturn` which caused missed opportunities down the line.
* [Attributor][FIX] Make AAValueSimplifyArgument aware of thread-dependent ↵Johannes Doerfert2019-11-021-0/+1
| | | | | | | constants As in IPConstantProp, thread-dependent constants need not be propagated over callbacks. Took the comment and test from there, see also D56447.
* [Attributor][FIX] Handle the default case of a switchJohannes Doerfert2019-11-021-1/+42
| | | | | | In D69605 only the "cases" of a switch were handled but if none matched we did not make the default case life. This is fixed now and properly tested (with code from IPConstantProp/user-with-multiple-uses.ll).
* [Attributor][FIX] Make value simplification aware of "complicated" attributesJohannes Doerfert2019-11-021-1/+83
| | | | | | We cannot simply replace arguments that carry attributes like `nest`, `inalloca`, `sret`, and `byval`. Except for the last one, which we can replace if it is not written, we bail for now.
* [Attributor][NFCI] Avoid unnecessary work except for testingJohannes Doerfert2019-11-0224-44/+73
| | | | | | | | Trying to deduce information for declarations and calls sites of declarations is not useful in practice but only for testing. Add a flag that disables this by default but also enable it in the tests. The misc.ll test will verify the flag "works" as expected.
* [Attributor][FIX] NoCapture is not a subsuming propertyJohannes Doerfert2019-11-021-0/+31
| | | | | | We cannot look at the subsuming positions and take their nocapture bit as shown with the two tests for which we derived nocapture on the call site argument and readonly on the argument of the second before.
* [JT][CVP] Regenerate test checks, againNikita Popov2019-11-015-61/+136
| | | | | The changes to update_test_checks format have been disabled again, so regenerate these tests. Also regenerate select.ll.
* [LV] Move interleave_short_tc.ll into the X86 directory to hopefully make ↵Craig Topper2019-11-011-0/+0
| | | | fix non-X86 bots.
* [InstCombine] regenerate test checks; NFCSanjay Patel2019-11-013-186/+162
| | | | Avoid subsequent test noise from improved CHECK-LABEL matching.
* [SLP] avoid 'tmp' value name conflict with auto-generated CHECK script; NFCSanjay Patel2019-11-011-23/+23
| | | | | | | | | The script uses 'TMP#' as its substitute for nameless values, so if a test already contains 'tmp#' *named* values, then there could be trouble. We should probably just fix the script to avoid this problem going forward, but it's easy enough to change a test too (and explicitly naming variables 'tmp' is always a sad choice).
* [SLP] avoid 'tmp' value name conflict with auto-generated CHECK script; NFCSanjay Patel2019-11-011-50/+50
| | | | | | | | | The script uses 'TMP#' as its substitute for nameless values, so if a test already contains 'tmp#' *named* values, then there could be trouble. We should probably just fix the script to avoid this problem going forward, but it's easy enough to change a test too (and explicitly naming variables 'tmp' is always a sad choice).
* [SLP] avoid 'tmp' value name conflict with auto-generated CHECK script; NFCSanjay Patel2019-11-011-88/+87
| | | | | | | | | The script uses 'TMP#' as its substitute for nameless values, so if a test already contains 'tmp#' *named* values, then there could be trouble. We should probably just fix the script to avoid this problem going forward, but it's easy enough to change a test too (and explicitly naming variables 'tmp' is always a sad choice).
* [LV] Add test case that was supposed to go with D67948Craig Topper2019-10-311-0/+59
| | | | I forgot to git add it when I committed for Evgeniy.
* [CVP] Add tests for icmp on local ranges; NFCNikita Popov2019-10-311-10/+43
| | | | | We currently don't simplify these, because getPredicateAt() does not use block values.
* [LVI] Regenerate test checks; NFCNikita Popov2019-10-313-56/+100
|
* [Attributor] Really use the executed-contextJohannes Doerfert2019-10-315-20/+18
| | | | | | | | | | | | | | | | | | Before we did not follow casts and geps when we looked at the users of a pointer in the pointers must-be-executed-context. This caused us to fail to determine if it was accessed for sure. With this change we follow such users now. The above extension exposed problems in getKnownNonNullAndDerefBytesForUse which did not always check what the base pointer was. We also did not handle negative offsets as conservative as we have to without explicit loop handling. Finally, we should not derive a huge number if we access a pointer that was traversed backwards first. The problems exposed by this functional change are already tested in the existing test cases as is the functional change. Differential Revision: https://reviews.llvm.org/D69647
* [SLP] Vectorize jumbled stores.Alexey Bataev2019-10-313-9/+111
| | | | | | | | | | | | | Summary: Patch adds support for vectorization of the jumbled stores. The value operands are vectorized and then shuffled in the right order before store. Reviewers: RKSimon, spatel, hfinkel, mkuper Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D43339
* [Attributor] Make AANonNull perform context sensitive queriesJohannes Doerfert2019-10-311-1/+94
| | | | | | | | | | | | | | | | | Summary: In order to get context sensitivity from isKnownNonZero we need to provide a context instruction *and* a dominator tree. The latter is passed now to which actually allows to remove some initialization code. Tests taken from PR43833. Reviewers: uenoku, sstefan1 Subscribers: hiraditya, bollu, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69595
* [ValueTracking] Allow context-sensitive nullness check for non-pointersJohannes Doerfert2019-10-313-12/+6
| | | | | | | | | | | | | | | Same as D60846 but with a fix for the problem encountered there which was a missing context adjustment in the handling of PHI nodes. The test that caused D60846 to be reverted was added in e15ab8f277c7. Reviewers: nikic, nlopes, mkazantsev,spatel, dlrobertson, uabelho, hakzsam Subscribers: hiraditya, bollu, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69571
* [InstCombine] Add the test that triggered the D60846 revertJohannes Doerfert2019-10-311-0/+42
| | | | This is in preparation of D69571.
* [InstCombine] add fast-math-flags for better test coverage; NFCSanjay Patel2019-10-311-50/+50
| | | | In all cases, we currently unintentionally drop the FMF on the new select.
* [IPCP] Bail on extractvalue's with more than 1 index.Craig Topper2019-10-311-0/+29
| | | | | | | | | | | | | | The replacement code only looks at the first index of the extractvalue. If there are additional indices we'll end up doing a bad replacement. This only happens if the function returns a nested struct. Not sure if clang ever generates such code. The original report came from ispc. Fixes PR43857 Differential Revision: https://reviews.llvm.org/D69656
* [InstCombine] regenerate test checks; NFCSanjay Patel2019-10-311-48/+63
|
* [InstCombine] Canonicalize uadd.with.overflow to uadd.satDavid Green2019-10-311-8/+2
| | | | | | | | | | | This adds some patterns to transform uadd.with.overflow to uadd.sat (with usub.with.overflow to usub.sat too). The patterns selects from UINTMAX (or 0 for subs) depending on whether the operation overflowed. Signed patterns are a little more involved (they can wrap in two directions), but can be added here in a followup patch too. Differential Revision: https://reviews.llvm.org/D69245
* Revert "[SLP] Vectorize jumbled stores."Haojian Wu2019-10-312-7/+9
| | | | | | This reverts commit 21d498c9c0f32dcab5bc89ac593aa813b533b43a. This commit causes some crashes on some targets.
* [Attributor][NFCI] Improve the usage of IntegerStatesJohannes Doerfert2019-10-311-1/+1
| | | | | Setting the upper bound directly in the state can be beneficial and simplifies the logic. This also exposed more copy&paste type errors.
* [Attributor][FIX] Unbreak buildbot through test correctionJohannes Doerfert2019-10-311-10/+23
|
* [Attributor] Make liveness "edge-based"Johannes Doerfert2019-10-319-19/+94
| | | | | | | | | | | | | | | | Summary: If control is transferred to a successor is the key question when it comes to liveness. The new implementation puts that question in the focus and thereby providing a clean way to assume certain CFG edges are dead or instructions will not transfer control. Reviewers: sstefan1, uenoku Subscribers: hiraditya, bollu, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69605
* [Attributor] Liveness for valuesJohannes Doerfert2019-10-318-38/+213
| | | | | | | | | | | | | | | | | | | | | | | Summary: This patch introduces liveness (AAIsDead) for all positions, thus for all kinds of values. For now, we say an instruction is dead if it would be removed assuming all users are dead. A call site return is different as we just look at the users. If all call site returns have been eliminated, the return values can return undef instead of their original value, eliminating uses. We try to recursively delete dead instructions now and we introduce a simple check interface for use-traversal. This is the idea tried out in D68626 but implemented in the right way. Reviewers: uenoku, sstefan1 Subscribers: hiraditya, bollu, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68925
* [Attributor][NFC] Do not delete dead blocks but "clear" themJohannes Doerfert2019-10-311-3/+0
| | | | | | | Deleting blocks will require us to deal with dead edges, e.g., `br i1 false, label %live, label %dead` explicitly. For now we just clear the blocks and move on. This will be revisited once we actually fold branches.
* [MustExecute] Forward iterate over conditional branchesJohannes Doerfert2019-10-311-11/+221
| | | | | | | | | | | | | | | | | | | Summary: If a conditional branch is encountered we can try to find a join block where the execution is known to continue. This means finding a suitable block, e.g., the immediate post dominator of the conditional branch, and proofing control will always reach that block. This patch implements different techniques that work with and without provided analysis. Reviewers: uenoku, sstefan1, hfinkel Subscribers: hiraditya, bollu, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68933
* [Attributor] Add "free"-based heap2stack deductionJohannes Doerfert2019-10-302-14/+34
| | | | | | | | | | | | | | | Summary: If there is a unique free of the allocated that has to be reached from the malloc, we can apply the heap-2-stack transformation even if the pointer escapes. Reviewers: hfinkel, sstefan1, uenoku Subscribers: hiraditya, bollu, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68958
* Revert "[CodeView] Add option to disable inline line tables."Amy Huang2019-10-301-99/+0
| | | | | | because it breaks compiler-rt tests. This reverts commit 6d03890384517919a3ba7fe4c35535425f278f89.
* [CodeView] Add option to disable inline line tables.Amy Huang2019-10-301-0/+99
| | | | | | | | | | | | | | | | | Summary: This adds a clang option to disable inline line tables. When it is used, the inliner uses the call site as the location of the inlined function instead of marking it as an inline location with the function location. See https://bugs.llvm.org/show_bug.cgi?id=42344 Reviewers: rnk Subscribers: hiraditya, cfe-commits, llvm-commits Tags: #clang, #llvm Differential Revision: https://reviews.llvm.org/D67723
* [InstCombine] keep assumption before sinking callstyker2019-10-311-0/+192
| | | | | | | | | | | | | | | | | | | | | | | | | | Summary: in the following C code the branch is not removed by clang in O3. ``` int f1(char* p) { int i1 = __builtin_strlen(p); if (!p) return -1; return i1; } ``` The issue is that the call to strlen is sunk to the following block by instcombine. In its new place the call to strlen doesn't dominate the use in the icmp anymore so value tracking can't see that p cannot be null. This patch resolves the issue by inserting an assumption at the place of the call before sinking a call when that call can be used to prove an argument to be nonnull. This resolves this issue at O3. Reviewers: majnemer, xbolva00, fhahn, jdoerfert, spatel, efriedma Reviewed By: jdoerfert Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69477
* [SLP] Vectorize jumbled stores.Alexey Bataev2019-10-302-9/+7
| | | | | | | | | | | | | Summary: Patch adds support for vectorization of the jumbled stores. The value operands are vectorized and then shuffled in the right order before store. Reviewers: RKSimon, spatel, hfinkel, mkuper Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D43339
* [NFC][LoopUnroll] Tests for peeling of first iteration (PR43840)Roman Lebedev2019-10-301-1/+232
|
* [X86] Make memcmp vector lowering handle arbitrary expansionsDavid Zarzycki2019-10-301-70/+70
| | | | | | | | | | Teach combineVectorSizedSetCCEquality() to handle arbitrary memcmp expansions but do not change any default policy for now. This also fixes a bug in the memcmp expansion itself when large displacements are needed. https://reviews.llvm.org/D69507
* [SLP] Generalization of stores vectorization.Alexey Bataev2019-10-2918-403/+769
| | | | | | | | | Stores are vectorized with maximum vectorization factor of 16. Patch tries to improve the situation and use maximal vectorization factor. Reviewers: spatel, RKSimon, mkuper, hfinkel Differential Revision: https://reviews.llvm.org/D43582
* [InstCombine] make icmp vector canonicalization safe for constant with undef ↵Sanjay Patel2019-10-297-9/+9
| | | | | | | | | | | | | | | | | elements This is a fix for: https://bugs.llvm.org/show_bug.cgi?id=43730 ...and as shown there, we have existing test cases that show potential miscompiles. We could just bail out for vector constants that contain any undef elements, or we can do as shown here: allow the transform, but replace the undefs with a safe value. For most of the tests shown, this results in a full splat constant (no undefs) which is probably a win for further IR analysis because we conservatively don't match undefs in most cases. Codegen can probably recover these kinds of undef lanes via demanded elements analysis if that's profitable. Differential Revision: https://reviews.llvm.org/D69519
* [InstCombine] add tests for icmp predicate canonicalization with vector ↵Sanjay Patel2019-10-291-5/+14
| | | | | | types; NFC Increase coverage for D69519.
* [LCSSA] Forget values we create LCSSA phis forFlorian Hahn2019-10-291-0/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Currently we only forget the loop we added LCSSA phis for. But SCEV expressions in other loops could also depend on the instruction we added a PHI for and currently we do not invalidate those expressions. This can happen when we use ScalarEvolution before converting a function to LCSSA form. The SCEV expressions will refer to the non-LCSSA value. If this SCEV expression is then used with the expander, we do not preserve LCSSA form. This patch properly forgets the values we created PHIs for. Those need to be recomputed again. This patch fixes PR43458. Currently SCEV::verify does not catch this mismatch and any test would need to run multiple passes to trigger the error (e.g. -loop-reduce -loop-unroll). I will also look into catching this kind of mismatch in the verifier. Also, we currently forget the whole loop in LCSSA and I'll check if we can be more surgical. Reviewers: efriedma, sanjoy.google, reames Reviewed By: efriedma Subscribers: zzheng, hiraditya, javed.absar, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68194
* [ConstantFold] Fold extractelement of getelementptrJay Foad2019-10-282-2/+2
| | | | | | | | | | | | | | Summary: Getelementptr has vector type if any of its operands are vectors (the scalar operands being implicitly broadcast to all vector elements). Extractelement applied to a vector getelementptr can be folded by applying the extractelement in turn to all of the vector operands. Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69379
* [LV] Interleaving should not exceed estimated loop trip count.Craig Topper2019-10-281-1/+1
| | | | | | | | | | Currently we may do iterleaving by more than estimated trip count coming from the profile or computed maximum trip count. The solution is to use "best known" trip count instead of exact one in interleaving analysis. Patch by Evgeniy Brevnov. Differential Revision: https://reviews.llvm.org/D67948
* [utils] InlineFunction: fix for debug info affecting optimizationsBjorn Pettersson2019-10-281-0/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Debug info affects output from "opt -inline", InlineFunction could not handle the llvm.dbg.value when it exist between alloca instructions. Problem was that the first alloca in a sequence of allocas was handled differently from the subsequence alloca instructions. Now all static alloca instructions are treated the same (being removed if the have no uses). So it does not matter if there are dbg instructions (or any other instructions) in between. Fix the issue: https://bugs.llvm.org/show_bug.cgi?id=43291k Patch by: yechunliang (Chris Ye) Reviewers: bjope, jmorse, vsk, probinson, jdoerfert, mtrofin, aprantl, fhahn Reviewed By: bjope Subscribers: uabelho, ormris, aprantl, hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D68633
* [InstCombine] Extra combine for uadd_satDavid Green2019-10-281-8/+4
| | | | | | | This is an extra fold for a canonical form of uadd_sat, as shown in D68651. It essentially selects uadd from an add and a select. Differential Revision: https://reviews.llvm.org/D69244
* [InstCombine][NFC] Tests for uadd.sat and sadd.sat canonicalisation.David Green2019-10-282-0/+778
|
* [CVP] prevent propagating poison when substituting edge values into a phi ↵Sanjay Patel2019-10-281-2/+1
| | | | | | | | | | | | | | | | | (PR43802) This phi simplification transform was added with: D45448 However as shown in PR43802: https://bugs.llvm.org/show_bug.cgi?id=43802 ...we must be careful not to propagate poison when we do the substitution. There might be some more complicated analysis possible to retain the overflow flag, but it should always be safe and easy to drop flags (we have similar behavior in instcombine and other passes). Differential Revision: https://reviews.llvm.org/D69442
* [CVP] add test for poison propagation bug (PR43802); NFCSanjay Patel2019-10-251-0/+27
|
OpenPOWER on IntegriCloud