Revision tags: llvmorg-12.0.0-rc3, llvmorg-12.0.0-rc2, llvmorg-11.1.0, llvmorg-11.1.0-rc3, llvmorg-12.0.0-rc1, llvmorg-13-init, llvmorg-11.1.0-rc2, llvmorg-11.1.0-rc1, llvmorg-11.0.1, llvmorg-11.0.1-rc2, llvmorg-11.0.1-rc1 |
|
#
a7efed5a |
| 26-Oct-2020 |
Nikita Popov <nikita.ppv@gmail.com> |
[SCEV] Improve handling of not expressions in isImpliedCond()
SCEV currently tries to prove implications of x pred y by also trying to imply ~y pred ~x. This is expensive in terms of compile-time (i
[SCEV] Improve handling of not expressions in isImpliedCond()
SCEV currently tries to prove implications of x pred y by also trying to imply ~y pred ~x. This is expensive in terms of compile-time (in fact, the majority of isImpliedCond compile-time is spent here) and generally not fruitful. The issue is that this also swaps the operands and thus breaks canonical ordering. If originally we were trying to prove an implication like X > C1 -> Y > C2, then we'll now try to prove X > C1 -> C3 > ~Y, which will not work.
The only real case where we can get some use out of this transform is if the original conditions were in the form X > C1 -> Y < C2, were then swapped to X > C1 -> C2 > Y and are then swapped again here to X > C1 -> ~Y > C3.
As such, handle this at a higher level, where we are doing the swapping in the first place. There's four different ways that we can line up a predicate and a swapped predicate, so we use some heuristics to pick some profitable way.
Because we now try this transform at a higher level (isImpliedCondOperands rather than isImpliedCondOperandsHelper), we can also prove additional facts. Of the added tests, one was proven previously while the other wasn't.
Differential Revision: https://reviews.llvm.org/D90926
show more ...
|
#
b00209ed |
| 22-Mar-2021 |
Juneyoung Lee <aqjune@gmail.com> |
[SCEV] Use logical and/or matcher
This is a minor patch that updates ScalarEvolution::isImpliedCond to use logical and/or matcher.
|
#
93ce855d |
| 22-Mar-2021 |
Philip Reames <listmail@philipreames.com> |
2nd attempt at a speculative fix for windows builders after d4648eea
|
#
6ba73c47 |
| 22-Mar-2021 |
Philip Reames <listmail@philipreames.com> |
Speculative fix for windows builders after d4648eea
|
#
d4648eea |
| 22-Mar-2021 |
Philip Reames <listmail@philipreames.com> |
[SCEV] Use trip count information to improve shift recurrence ranges
This patch exploits the knowledge that we may be running many fewer than bitwidth iterations of the loop, and may be able to disa
[SCEV] Use trip count information to improve shift recurrence ranges
This patch exploits the knowledge that we may be running many fewer than bitwidth iterations of the loop, and may be able to disallow the overflow case. This patch specifically implements only the shl case, but this can be generalized to ashr and lshr without difficulty.
Differential Revision: https://reviews.llvm.org/D98222
show more ...
|
#
00d0315a |
| 19-Mar-2021 |
Philip Reames <listmail@philipreames.com> |
[SCEV] Factor out a lambda for strict condition splitting [NFC]
|
#
fff1363b |
| 19-Mar-2021 |
Max Kazantsev <mkazantsev@azul.com> |
[SCEV] Add false->any implication
By definition of Implication operator, `false -> true` and `false -> false`. It means that `false` implies any predicate, no matter true or false. We don't need to
[SCEV] Add false->any implication
By definition of Implication operator, `false -> true` and `false -> false`. It means that `false` implies any predicate, no matter true or false. We don't need to go any further trying to prove the statement we need and just always say that `false` implies it in this case.
In practice it means that we are trying to prove something guarded by `false` condition, which means that this code is unreachable, and we can safely prove any fact or perform any transform in this code.
Differential Revision: https://reviews.llvm.org/D98706 Reviewed By: lebedev.ri
show more ...
|
#
b3a1500e |
| 18-Mar-2021 |
Max Kazantsev <mkazantsev@azul.com> |
[SCEV][NFC] API for predicate evaluation
Provides API that allows to check predicate for being true or false with one call. Current implementation is naive and just calls isKnownPredicate twice, but
[SCEV][NFC] API for predicate evaluation
Provides API that allows to check predicate for being true or false with one call. Current implementation is naive and just calls isKnownPredicate twice, but further we can rework this logic trying to use one check to prove both facts.
show more ...
|
#
5097143f |
| 16-Mar-2021 |
Max Kazantsev <mkazantsev@azul.com> |
[SCEV][NFC] Move check up the stack
One of (and primary) callers of isBasicBlockEntryGuardedByCond is isKnownPredicateAt, which makes isKnownPredicate check before it. It already makes non-recursive
[SCEV][NFC] Move check up the stack
One of (and primary) callers of isBasicBlockEntryGuardedByCond is isKnownPredicateAt, which makes isKnownPredicate check before it. It already makes non-recursive check inside. So, on this execution path this check is made twice. The only other caller is isLoopEntryGuardedByCond. Moving the check there should save some compile time.
show more ...
|
#
78b8ce40 |
| 13-Mar-2021 |
Roman Lebedev <lebedev.ri@gmail.com> |
Reland [SCEV] Improve modelling for (null) pointer constants
This reverts commit 329aeb5db43f5e69df038fb20d2def77fe6f8595, and relands commit 61f006ac655431bd44b9e089f74c73bec0c1a48c.
This is a con
Reland [SCEV] Improve modelling for (null) pointer constants
This reverts commit 329aeb5db43f5e69df038fb20d2def77fe6f8595, and relands commit 61f006ac655431bd44b9e089f74c73bec0c1a48c.
This is a continuation of D89456.
As it was suggested there, now that SCEV models `PtrToInt`, we can try to improve SCEV's pointer handling. In particular, i believe, i will need this in the future to further fix `SCEVAddExpr`operation type handling.
This removes special handling of `ConstantPointerNull` from `ScalarEvolution::createSCEV()`, and add constant folding into `ScalarEvolution::getPtrToIntExpr()`. This way, `null` constants stay as such in SCEV's, but gracefully become zero integers when asked.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D98147
show more ...
|
#
329aeb5d |
| 13-Mar-2021 |
Roman Lebedev <lebedev.ri@gmail.com> |
Temporairly evert "[SCEV] Improve modelling for (null) pointer constants"
This appears to have broken ubsan bot: https://lab.llvm.org/buildbot/#/builders/85/builds/3062 https://reviews.llvm.org/D981
Temporairly evert "[SCEV] Improve modelling for (null) pointer constants"
This appears to have broken ubsan bot: https://lab.llvm.org/buildbot/#/builders/85/builds/3062 https://reviews.llvm.org/D98147#2623549
It looks like LSR needs some kind of a change around insertion point handling. Reverting until i have a fix.
This reverts commit 61f006ac655431bd44b9e089f74c73bec0c1a48c.
show more ...
|
#
61f006ac |
| 12-Mar-2021 |
Roman Lebedev <lebedev.ri@gmail.com> |
[SCEV] Improve modelling for (null) pointer constants
This is a continuation of D89456.
As it was suggested there, now that SCEV models `PtrToInt`, we can try to improve SCEV's pointer handling. In
[SCEV] Improve modelling for (null) pointer constants
This is a continuation of D89456.
As it was suggested there, now that SCEV models `PtrToInt`, we can try to improve SCEV's pointer handling. In particular, i believe, i will need this in the future to further fix `SCEVAddExpr`operation type handling.
This removes special handling of `ConstantPointerNull` from `ScalarEvolution::createSCEV()`, and add constant folding into `ScalarEvolution::getPtrToIntExpr()`. This way, `null` constants stay as such in SCEV's, but gracefully become zero integers when asked.
Reviewed By: Meinersbur
Differential Revision: https://reviews.llvm.org/D98147
show more ...
|
#
a25b537b |
| 09-Mar-2021 |
Philip Reames <listmail@philipreames.com> |
[SCEV] Infer known bits from known sign bits
This was suggested by lebedev.ri over on D96534. You'll note lack of tests. During review, we weren't actually able to find a case which exercises it,
[SCEV] Infer known bits from known sign bits
This was suggested by lebedev.ri over on D96534. You'll note lack of tests. During review, we weren't actually able to find a case which exercises it, but both I and lebedev.ri feel it's a reasonable change, straight forward, and near free.
Differential Revision: https://reviews.llvm.org/D97064
show more ...
|
#
4a5edea1 |
| 19-Feb-2021 |
Philip Reames <listmail@philipreames.com> |
[SCEV] Use both known bits and sign bits when computing range of SCEV unknowns
When computing a range for a SCEVUnknown, today we use computeKnownBits for unsigned ranges, and computeNumSignBots for
[SCEV] Use both known bits and sign bits when computing range of SCEV unknowns
When computing a range for a SCEVUnknown, today we use computeKnownBits for unsigned ranges, and computeNumSignBots for signed ranges. This means we miss opportunities to improve range results.
One common missed pattern is that we have a signed range of a value which CKB can determine is positive, but CNSB doesn't convey that information. The current range includes the negative part, and is thus double the size.
Per the removed comment, the original concern which delayed using both (after some code merging years back) was a compile time concern. CTMark results (provided by Nikita, thanks!) showed a geomean impact of about 0.1%. This doesn't seem large enough to avoid higher quality results.
Differential Revision: https://reviews.llvm.org/D96534
show more ...
|
#
df35a183 |
| 17-Feb-2021 |
Kazu Hirata <kazu@google.com> |
[SCEV] Use ListSeparator (NFC)
|
#
606aa622 |
| 11-Feb-2021 |
Michael Kruse <llvm-project@meinersbur.de> |
Revert "[AssumptionCache] Avoid dangling llvm.assume calls in the cache"
This reverts commit b7d870eae7fdadcf10d0f177faa7409c2e37d776 and the subsequent fix "[Polly] Fix build after AssumptionCache
Revert "[AssumptionCache] Avoid dangling llvm.assume calls in the cache"
This reverts commit b7d870eae7fdadcf10d0f177faa7409c2e37d776 and the subsequent fix "[Polly] Fix build after AssumptionCache change (D96168)" (commit e6810cab09fcbc87b6e5e4d226de0810e2f2ea38).
It caused indeterminism in the output, such that e.g. the polly-x86_64-linux buildbot failed accasionally.
show more ...
|
#
9bf3cfa7 |
| 10-Feb-2021 |
Philip Reames <listmail@philipreames.com> |
[SCEV] Add a missing AssumptionCache parameter
The AssumptionCache mechanism is used to feed assumes into known bits computations. Most places in SCEV passed it in, but one place appears to have be
[SCEV] Add a missing AssumptionCache parameter
The AssumptionCache mechanism is used to feed assumes into known bits computations. Most places in SCEV passed it in, but one place appears to have been missed.
Spotted via inspection, don't have a test case which actually exercises this, but it seemed like an obvious fixit.
show more ...
|
#
b7d870ea |
| 05-Feb-2021 |
Johannes Doerfert <johannes@jdoerfert.de> |
[AssumptionCache] Avoid dangling llvm.assume calls in the cache
PR49043 exposed a problem when it comes to RAUW llvm.assumes. While D96106 would fix it for GVNSink, it seems a more general concern.
[AssumptionCache] Avoid dangling llvm.assume calls in the cache
PR49043 exposed a problem when it comes to RAUW llvm.assumes. While D96106 would fix it for GVNSink, it seems a more general concern. To avoid future problems this patch moves away from the vector of weak reference model used in the assumption cache. Instead, we track the llvm.assume calls with a callback handle which will remove itself from the cache if the call is deleted.
Fixes PR49043.
Reviewed By: nikic
Differential Revision: https://reviews.llvm.org/D96168
show more ...
|
#
d475030d |
| 11-Dec-2020 |
Gil Rapaport <gil.rapaport@intel.com> |
[SCEV] Apply loop guards to divisibility tests
Extend applyLoopGuards() to take into account conditions/assumes proving some value %v to be divisible by D by rewriting %v to (%v / D) * D. This lets
[SCEV] Apply loop guards to divisibility tests
Extend applyLoopGuards() to take into account conditions/assumes proving some value %v to be divisible by D by rewriting %v to (%v / D) * D. This lets the loop unroller and the loop vectorizer identify more loops as not requiring remainder loops.
Differential Revision: https://reviews.llvm.org/D95521
show more ...
|
#
f1e81361 |
| 01-Feb-2021 |
Florian Hahn <flo@fhahn.com> |
[SCEV] Bail out if URem operand cannot be zero-extended.
In some cases, LHS is larger than the target expression type. Bail out in that case for now, to avoid crashing
|
#
8a4ad884 |
| 29-Jan-2021 |
Max Kazantsev <mkazantsev@azul.com> |
[SCEV] Do not cache comparison result upon reached max depth as "equivalence". PR48725
We use `EquivalenceClasses` to cache the notion that two SCEVs are equivalent, so save time in situation when `
[SCEV] Do not cache comparison result upon reached max depth as "equivalence". PR48725
We use `EquivalenceClasses` to cache the notion that two SCEVs are equivalent, so save time in situation when `A` is equivalent to `B` and `B` is equivalent to `C`, making check "if `A` is equivalent to `C`?" cheaper.
We also return `0` in the comparator when we reach max analysis depth to save compile time. After doing this, we also cache them as being equivalent.
Now, imagine the following situation: - `A` is proved equivalent to `B`; - `C` is proved equivalent to `D`; - Comparison of `A` against `D` is proved non-zero; - Comparison of `B` against `C` reaches max depth (and gets cached as equivalence).
Now, before the invocation of compare(`B`, `C`), `A` and `D` belonged to different equivalence classes, and their comparison returned non-zero. After the the invocation of compare(`B`, `C`), equivalence classes get merged and `A`, `B`, `C` and `D` all fall into the same equivalence class. So the comparator will change its behavior for couple `A` and `D`, with weird consequences following it. This comparator is finally used in `std::stable_sort`, and this behavior change makes it crash (looks like it's causing a memory corruption).
Solution: this patch changes `CompareSCEVComplexity` to return `None` when the max depth is reached. So in this case, we do not cache these SCEVs (and their parents in the tree) as being equivalent.
Differential Revision: https://reviews.llvm.org/D94654 Reviewed By: lebedev.ri
show more ...
|
#
00fcc036 |
| 26-Jan-2021 |
Mindong Chen <chenmindong1@huawei.com> |
[SCEV] Fix incorrect loop exit count analysis.
In computeLoadConstantCompareExitLimit, the addrec used to compute the exit count should be from the loop which the exiting block belongs to.
Reviewed
[SCEV] Fix incorrect loop exit count analysis.
In computeLoadConstantCompareExitLimit, the addrec used to compute the exit count should be from the loop which the exiting block belongs to.
Reviewed by: mkazantsev
Differential Revision: https://reviews.llvm.org/D92367
show more ...
|
#
8f5da41c |
| 21-Jan-2021 |
Kazu Hirata <kazu@google.com> |
[llvm] Construct SmallVector with iterator ranges (NFC)
|
#
23b0ab2a |
| 18-Jan-2021 |
Kazu Hirata <kazu@google.com> |
[llvm] Use the default value of drop_begin (NFC)
|
#
19aacdb7 |
| 16-Jan-2021 |
Kazu Hirata <kazu@google.com> |
[llvm] Construct SmallVector with iterator ranges (NFC)
|