diff options
author | Nikita Popov <npopov@redhat.com> | 2023-05-16 17:05:58 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2023-05-25 09:34:19 +0200 |
commit | d5c56c5162e535baec61e385f53e512adeaa2815 (patch) | |
tree | ac7396905169a060cef67b56f163d01703900040 /llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | |
parent | cfd90939f70805f9824ac6b99bbe3ef4e50c7e8b (diff) | |
download | llvm-d5c56c5162e535baec61e385f53e512adeaa2815.zip llvm-d5c56c5162e535baec61e385f53e512adeaa2815.tar.gz llvm-d5c56c5162e535baec61e385f53e512adeaa2815.tar.bz2 |
[SCEVExpander] Remember phi nodes inserted by LCSSA construction
SCEVExpander keeps track of all instructions it inserted. However,
it currently misses some phi nodes created during LCSSA construction.
Fix this by collecting these into another argument.
This also removes the IRBuilder argument, which was added for
essentially the same purpose, but only handles the root LCSSA nodes,
not those inserted by SSAUpdater.
This was reported as a regression on D149344, but the reduced test
case also reproduces without it.
Differential Revision: https://reviews.llvm.org/D150681
Diffstat (limited to 'llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp index 003e7d3..c999e00 100644 --- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp +++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp @@ -2561,7 +2561,11 @@ Value *SCEVExpander::fixupLCSSAFormFor(Value *V) { SmallVector<Instruction *, 1> ToUpdate; ToUpdate.push_back(DefI); SmallVector<PHINode *, 16> PHIsToRemove; - formLCSSAForInstructions(ToUpdate, SE.DT, SE.LI, Builder, &PHIsToRemove); + SmallVector<PHINode *, 16> InsertedPHIs; + formLCSSAForInstructions(ToUpdate, SE.DT, SE.LI, &PHIsToRemove, + &InsertedPHIs); + for (PHINode *PN : InsertedPHIs) + rememberInstruction(PN); for (PHINode *PN : PHIsToRemove) { if (!PN->use_empty()) continue; |