#
3849dc1f |
| 14-Feb-2023 |
Max Kazantsev <mkazantsev@azul.com> |
[NFC] Move some asserts out of Expensive Checks
This was done by reviewer's request, but in fact without them we skip very nasty bugs. Unless it is a REAL problem, I'd keep them in default setup.
|
#
cfeb0bf8 |
| 14-Feb-2023 |
Max Kazantsev <mkazantsev@azul.com> |
[SimpleLoopUnswitch] Temorarily switch off simple-loop-unswitch-inject-invariant-conditions. PR60736
It caused an assertion failure, not sure induced or introduced. Disabling to investigate it. See
[SimpleLoopUnswitch] Temorarily switch off simple-loop-unswitch-inject-invariant-conditions. PR60736
It caused an assertion failure, not sure induced or introduced. Disabling to investigate it. See details at https://github.com/llvm/llvm-project/issues/60736
show more ...
|
#
5d107533 |
| 10-Feb-2023 |
Max Kazantsev <mkazantsev@azul.com> |
[SimpleLoopUnswitch] Inject loop-invariant conditions and unswitch them when it's profitable
Based on https://discourse.llvm.org/t/rfc-inject-invariant-conditions-to-loops-to-enable-unswitching-and-
[SimpleLoopUnswitch] Inject loop-invariant conditions and unswitch them when it's profitable
Based on https://discourse.llvm.org/t/rfc-inject-invariant-conditions-to-loops-to-enable-unswitching-and-constraint-elimination
This transform attempts to handle the following loop: ``` for (...) { x = <some variant> if (x <u C1) {} else break; if (x <u C2) {} else break; } ``` Here `x` is some loop-variant value, and `C1` and `C2` are loop invariants. As we see, this loop has no invariant checks we can unswitch on. However, there is an invariant condition that can make the second check redundant. Specifically, it is `C1 <=u C2`. We can modify this code in the following way: ``` for (...) { x = <some variant> if (x <u C1) {} else break; if (C1 <=u C2) { /* no check is required */ } else { // do the check normally if (x <u C2) {} else break; } } ``` Now we have an invariant condition `C1 <=u C2` and can unswitch on it.
This patch introduces the basic version of this transform, with some limitations, all of them seem liftable (but needs more work & testing): - All checks are `ult` condition; - All branches in question stay in loop if the said condition is true and leave it otherwise; - All in-loop branches are hot enough;
There is also a room for improvement cost model. So far we evalutate the cost of unswitching this newly injected invariant branch the same as if we would unswitch on 2nd condition, which is not exactly precise (but also not grossly wrong).
Differential Revision: https://reviews.llvm.org/D136233 Reviewed By: skatkov
show more ...
|
Revision tags: llvmorg-16.0.0-rc2, llvmorg-16.0.0-rc1, llvmorg-17-init, llvmorg-15.0.7 |
|
#
38818b60 |
| 04-Jan-2023 |
serge-sans-paille <sguelton@mozilla.com> |
Move from llvm::makeArrayRef to ArrayRef deduction guides - llvm/ part
Use deduction guides instead of helper functions.
The only non-automatic changes have been:
1. ArrayRef(some_uint8_pointer, 0
Move from llvm::makeArrayRef to ArrayRef deduction guides - llvm/ part
Use deduction guides instead of helper functions.
The only non-automatic changes have been:
1. ArrayRef(some_uint8_pointer, 0) needs to be changed into ArrayRef(some_uint8_pointer, (size_t)0) to avoid an ambiguous call with ArrayRef((uint8_t*), (uint8_t*)) 2. CVSymbol sym(makeArrayRef(symStorage)); needed to be rewritten as CVSymbol sym{ArrayRef(symStorage)}; otherwise the compiler is confused and thinks we have a (bad) function prototype. There was a few similar situation across the codebase. 3. ADL doesn't seem to work the same for deduction-guides and functions, so at some point the llvm namespace must be explicitly stated. 4. The "reference mode" of makeArrayRef(ArrayRef<T> &) that acts as no-op is not supported (a constructor cannot achieve that).
Per reviewers' comment, some useless makeArrayRef have been removed in the process.
This is a follow-up to https://reviews.llvm.org/D140896 that introduced the deduction guides.
Differential Revision: https://reviews.llvm.org/D140955
show more ...
|
#
09778940 |
| 02-Jan-2023 |
Nikita Popov <npopov@redhat.com> |
[SimpleLoopUnswitch] Perform poison query before transform
I think this doesn't make any difference right now, but once we take into account that branch on undef is UB in programUndefinedIfUndefOrPo
[SimpleLoopUnswitch] Perform poison query before transform
I think this doesn't make any difference right now, but once we take into account that branch on undef is UB in programUndefinedIfUndefOrPoison() the new position of the branch would imply that the condition can't be poison, which would defeat the purpose of the freeze insertion here. We need to perform the check before the branch is moved.
show more ...
|
#
32b38d24 |
| 15-Dec-2022 |
Vasileios Porpodas <vporpodas@google.com> |
[NFC] Rename Instruction::insertAt() to Instruction::insertInto(), to be consistent with BasicBlock::insertInto()
Differential Revision: https://reviews.llvm.org/D140085
|
#
31521563 |
| 13-Dec-2022 |
Fangrui Song <i@maskray.me> |
[Transforms/Scalar] llvm::Optional => std::optional
|
Revision tags: llvmorg-15.0.6 |
|
#
06911ba6 |
| 28-Nov-2022 |
Vasileios Porpodas <vporpodas@google.com> |
[NFC] Cleanup: Replaces BB->getInstList().insert() with I->insertAt().
This is part of a series of cleanup patches towards making BasicBlock::getInstList() private.
Differential Revision: https://r
[NFC] Cleanup: Replaces BB->getInstList().insert() with I->insertAt().
This is part of a series of cleanup patches towards making BasicBlock::getInstList() private.
Differential Revision: https://reviews.llvm.org/D138877
show more ...
|
#
343de685 |
| 03-Dec-2022 |
Kazu Hirata <kazu@google.com> |
[Transforms] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount
[Transforms] Use std::nullopt instead of None (NFC)
This patch mechanically replaces None with std::nullopt where the compiler would warn if None were deprecated. The intent is to reduce the amount of manual work required in migrating from Optional to std::optional.
This is part of an effort to migrate from llvm::Optional to std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
show more ...
|
#
bebca2b6 |
| 28-Nov-2022 |
Vasileios Porpodas <vporpodas@google.com> |
[NFC] Cleanup: Replaces BB->getInstList().splice() with BB->splice().
This is part of a series of cleanup patches towards making BasicBlock::getInstList() private.
Differential Revision: https://re
[NFC] Cleanup: Replaces BB->getInstList().splice() with BB->splice().
This is part of a series of cleanup patches towards making BasicBlock::getInstList() private.
Differential Revision: https://reviews.llvm.org/D138979
show more ...
|
#
d90a14f8 |
| 27-Nov-2022 |
Kazu Hirata <kazu@google.com> |
[Scalar] Use std::optional in SimpleLoopUnswitch.cpp (NFC)
This is part of an effort to migrate from llvm::Optional to std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasval
[Scalar] Use std::optional in SimpleLoopUnswitch.cpp (NFC)
This is part of an effort to migrate from llvm::Optional to std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
show more ...
|
#
1f914944 |
| 22-Nov-2022 |
Kazu Hirata <kazu@google.com> |
Don't use Optional::getPointer (NFC)
Since std::optional does not offer getPointer(), this patch replaces X.getPointer() with &*X to make the migration from llvm::Optional to std::optional easier.
Don't use Optional::getPointer (NFC)
Since std::optional does not offer getPointer(), this patch replaces X.getPointer() with &*X to make the migration from llvm::Optional to std::optional easier.
This is part of an effort to migrate from llvm::Optional to std::optional:
https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716
Differential Revision: https://reviews.llvm.org/D138466
show more ...
|
Revision tags: llvmorg-15.0.5 |
|
#
7854a1ab |
| 13-Nov-2022 |
Florian Hahn <flo@fhahn.com> |
[SimpleLoopUnswitch] Forget SCEVs for replaced phis.
Forget SCEVs based on exit phis in case SCEV looked through the phi. After unswitching, it may not be possible to look through the phi due to it
[SimpleLoopUnswitch] Forget SCEVs for replaced phis.
Forget SCEVs based on exit phis in case SCEV looked through the phi. After unswitching, it may not be possible to look through the phi due to it having multiple incoming values, so it needs to be re-computed.
Fixes #58868
show more ...
|
#
ebac5999 |
| 02-Nov-2022 |
Dmitry Makogon <d.makogon@g.nsu.ru> |
[SimpleLoopUnswitch] Skip trivial selects in guards conditions unswitch candidates
We do this for conditional branches, but not for guards for some reason.
Fixes pr58666.
Differential Revision: ht
[SimpleLoopUnswitch] Skip trivial selects in guards conditions unswitch candidates
We do this for conditional branches, but not for guards for some reason.
Fixes pr58666.
Differential Revision: https://reviews.llvm.org/D137249
show more ...
|
#
a41cb8bf |
| 05-Nov-2022 |
Florian Hahn <flo@fhahn.com> |
[SimpleLoopUnswitch] Forget block & loop dispos during trivial unswitch.
Unswitching adjusts the CFG in ways that may invalidate cached loop dispositions. Clear all cached block and loop disposition
[SimpleLoopUnswitch] Forget block & loop dispos during trivial unswitch.
Unswitching adjusts the CFG in ways that may invalidate cached loop dispositions. Clear all cached block and loop dispositions during trivial unswitching. The same is already done for non-trivial unswitching.
Fixes #58751.
show more ...
|
Revision tags: llvmorg-15.0.4 |
|
#
1f1fb208 |
| 30-Oct-2022 |
Florian Hahn <flo@fhahn.com> |
[SimpleLoopUnswitch] Forget block and loop dispositions.
Also invalidate block and loop dispositions during non-trivial unswitching.
Fixes #58564.
|
Revision tags: llvmorg-15.0.3 |
|
#
f884a4c9 |
| 18-Oct-2022 |
Max Kazantsev <mkazantsev@azul.com> |
[NFC] Reuse NonTrivialUnswitchCandidate instead of std::pair
|
#
fbad5fdc |
| 12-Oct-2022 |
Max Kazantsev <mkazantsev@azul.com> |
[NFC] Perform all legality checks for non-trivial unswitch in one function
They have been scattered over the code. For better structuring, perform them in one place. Potential CT drop is possible be
[NFC] Perform all legality checks for non-trivial unswitch in one function
They have been scattered over the code. For better structuring, perform them in one place. Potential CT drop is possible because we collect exit blocks twice, but it's small price to pay for much better code structure.
show more ...
|
#
6bfcac61 |
| 12-Oct-2022 |
Max Kazantsev <mkazantsev@azul.com> |
[SimpleLoopUnswitch][NFC] Separate legality checks from cost computation
These are semantically two different stages, but were entwined in the old implementation. Now cost computation does not do le
[SimpleLoopUnswitch][NFC] Separate legality checks from cost computation
These are semantically two different stages, but were entwined in the old implementation. Now cost computation does not do legality checks, and they all are done beforehead.
show more ...
|
#
421728b4 |
| 12-Oct-2022 |
Max Kazantsev <mkazantsev@azul.com> |
[NFC] Factor out computation of best unswitch cost candidate
Split out a major peice of this method to make code more readable.
|
#
91aa9097 |
| 11-Oct-2022 |
Max Kazantsev <mkazantsev@azul.com> |
[NFC] Factor out collection of unswitch candidate to a separate function
Just to make the code more structured and easier to understand.
|
#
f1897991 |
| 11-Oct-2022 |
Max Kazantsev <mkazantsev@azul.com> |
[NFC] Refine API in SimpleLoopUnswitch: add missing const notions
|
Revision tags: working |
|
#
469f0fc6 |
| 05-Oct-2022 |
Florian Hahn <flo@fhahn.com> |
[SimpleLoopUnswitch] Clear dispos in deleteDeadBlocksFromLoop.
SimpleLoopUnswitch may remove blocks from loops. Clear block and loop dispositions in that case, to clean up invalid entries in the cac
[SimpleLoopUnswitch] Clear dispos in deleteDeadBlocksFromLoop.
SimpleLoopUnswitch may remove blocks from loops. Clear block and loop dispositions in that case, to clean up invalid entries in the cache.
Fixes #58158.
Fixes #58159.
show more ...
|
Revision tags: llvmorg-15.0.2 |
|
#
e399dd60 |
| 04-Oct-2022 |
Florian Hahn <flo@fhahn.com> |
[SimpleLoopUnswitch] Clear block and loop dispos after destroying loop.
SimpleLoopUnswitch may remove loops. Clear block and loop dispositions, to clean up invalid entries in the cache.
Fixes #5813
[SimpleLoopUnswitch] Clear block and loop dispos after destroying loop.
SimpleLoopUnswitch may remove loops. Clear block and loop dispositions, to clean up invalid entries in the cache.
Fixes #58136.
show more ...
|
Revision tags: llvmorg-15.0.1, llvmorg-15.0.0 |
|
#
fb45f3c9 |
| 04-Sep-2022 |
Ruobing Han <hanruobing@gatech.edu> |
[SimpleLoopUnswitch] Skip non-trivial unswitching of cold functions
In the current main branch, all cold loops will not be applied non-trivial unswitch. As reported in D129599, skipping these cold l
[SimpleLoopUnswitch] Skip non-trivial unswitching of cold functions
In the current main branch, all cold loops will not be applied non-trivial unswitch. As reported in D129599, skipping these cold loops will incur regression in SPEC benchmark. Thus, instead of skipping cold loops, now only skipping loops in cold functions.
Reviewed By: alexgatea, aeubanks
Differential Revision: https://reviews.llvm.org/D133275
show more ...
|