diff options
author | Johannes Doerfert <johannes@jdoerfert.de> | 2022-06-21 10:30:10 -0500 |
---|---|---|
committer | Johannes Doerfert <johannes@jdoerfert.de> | 2022-07-08 00:38:27 -0500 |
commit | f17639ea0cd30f52ac853ba2eb25518426cc3bb8 (patch) | |
tree | ca316ed926252d8c10b5cd80ee4f002ccd27744f /llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | |
parent | 17a81ecf857f847c7306dae0697a65b500bbf3c2 (diff) | |
download | llvm-f17639ea0cd30f52ac853ba2eb25518426cc3bb8.zip llvm-f17639ea0cd30f52ac853ba2eb25518426cc3bb8.tar.gz llvm-f17639ea0cd30f52ac853ba2eb25518426cc3bb8.tar.bz2 |
[Attributor] Replace AAValueSimplify with AAPotentialValues
For the longest time we used `AAValueSimplify` and
`genericValueTraversal` to determine "potential values". This was
problematic for many reasons:
- We recomputed the result a lot as there was no caching for the 9
locations calling `genericValueTraversal`.
- We added the idea of "intra" vs. "inter" procedural simplification
only as an afterthought. `genericValueTraversal` did offer an option
but `AAValueSimplify` did not. Thus, we might end up with "too much"
simplification in certain situations and then gave up on it.
- Because `genericValueTraversal` was not a real `AA` we ended up with
problems like the infinite recursion bug (#54981) as well as code
duplication.
This patch introduces `AAPotentialValues` and replaces the
`AAValueSimplify` uses with it. `genericValueTraversal` is folded into
`AAPotentialValues` as are the instruction simplifications performed in
`AAValueSimplify` before. We further distinguish "intra" and "inter"
procedural simplification now.
`AAValueSimplify` was not deleted as we haven't ported the
re-materialization of instructions yet. There are other differences over
the former handling, e.g., we may not fold trivially foldable
instructions right now, e.g., `add i32 1, 1` is not folded to `i32 2`
but if an operand would be simplified to `i32 1` we would fold it still.
We are also even more aware of function/SCC boundaries in CGSCC passes,
which is good even if some tests look like they regress.
Fixes: https://github.com/llvm/llvm-project/issues/54981
Note: A previous version was flawed and consequently reverted in
6555558a80589d1c5a1154b92cc3af9495f8f86c.
Diffstat (limited to 'llvm/lib/Transforms/Utils/BasicBlockUtils.cpp')
0 files changed, 0 insertions, 0 deletions