Commit 4653f93
committed
[SCEV] Introduce SCEVUse, use it instead of const SCEV * (NFCI) (WIP).
This patch introduces SCEVUse, which is a tagged pointer containing the
used const SCEV *, plus extra bits to store NUW/NSW flags that are only
valid at the specific use.
This was suggested by @nikic as an alternative
to #90742.
This patch just updates most SCEV infrastructure to operate on SCEVUse
instead of const SCEV *. It does not introduce any code that makes use
of the use-specific flags yet which I'll share as follow-ups.
Note that this should be NFC, but currently there's at least one case
where it is not (turn-to-invariant.ll), which I'll investigate once we
agree on the overall direction.
This PR at the moment also contains a commit that updates various SCEV
clients to use `const SCEV *` instead of `const auto *`, to prepare for
this patch. This reduces the number of changes needed, as SCEVUse will
automatically convert to `const SCEV *`. This is a safe default, as it
just drops the use-specific flags for the expression (it will not drop
any use-specific flags for any of its operands though).
This probably
SCEVUse could probably also be used to address mis-compiles due to
equivalent AddRecs modulo flags result in an AddRec with incorrect flags
for some uses of some phis, e.g. the one
#80430 attempted to fix
Compile-time impact:
stage1-O3: +0.06%
stage1-ReleaseThinLTO: +0.07%
stage1-ReleaseLTO-g: +0.07%
stage2-O3: +0.11%
https://llvm-compile-time-tracker.com/compare.php?from=ce055843e2be9643bd58764783a7bb69f6db8c9a&to=8c7f4e9e154ebc4862c4e2716cedc3c688352d7c&stat=instructions:u1 parent fa3258e commit 4653f93
File tree
13 files changed
+1766
-1675
lines changed- llvm
- include/llvm/Analysis
- lib
- Analysis
- Target/PowerPC
- Transforms
- Scalar
- Utils
- test/Transforms/IndVarSimplify
- unittests/Analysis
13 files changed
+1766
-1675
lines changedLarge diffs are not rendered by default.
Lines changed: 154 additions & 133 deletions
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1250 | 1250 | | |
1251 | 1251 | | |
1252 | 1252 | | |
1253 | | - | |
1254 | | - | |
1255 | | - | |
1256 | | - | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
1257 | 1259 | | |
1258 | 1260 | | |
1259 | 1261 | | |
| |||
1791 | 1793 | | |
1792 | 1794 | | |
1793 | 1795 | | |
1794 | | - | |
1795 | | - | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
1796 | 1799 | | |
1797 | 1800 | | |
1798 | 1801 | | |
| |||
1900 | 1903 | | |
1901 | 1904 | | |
1902 | 1905 | | |
1903 | | - | |
1904 | | - | |
| 1906 | + | |
| 1907 | + | |
| 1908 | + | |
1905 | 1909 | | |
1906 | 1910 | | |
1907 | 1911 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1422 | 1422 | | |
1423 | 1423 | | |
1424 | 1424 | | |
1425 | | - | |
| 1425 | + | |
1426 | 1426 | | |
1427 | 1427 | | |
1428 | 1428 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
494 | 494 | | |
495 | 495 | | |
496 | 496 | | |
497 | | - | |
| 497 | + | |
| 498 | + | |
498 | 499 | | |
499 | 500 | | |
500 | 501 | | |
| |||
0 commit comments