aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
diff options
context:
space:
mode:
authorFlorian Hahn <flo@fhahn.com>2022-01-09 18:38:41 +0000
committerFlorian Hahn <flo@fhahn.com>2022-01-09 18:38:41 +0000
commit1ce01b7dfe8247c25b25e0ed44b7f1e41599bb43 (patch)
tree1b01fb5e75bc3f8d6b0031b2675b9b39273fa807 /llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
parentfbf52caf58b3270c84e1cd3f399345272cca09a1 (diff)
downloadllvm-1ce01b7dfe8247c25b25e0ed44b7f1e41599bb43.zip
llvm-1ce01b7dfe8247c25b25e0ed44b7f1e41599bb43.tar.gz
llvm-1ce01b7dfe8247c25b25e0ed44b7f1e41599bb43.tar.bz2
[SCEVExpander] Simplify cleanup, skip sorting by dominance.
There is no need to sort inserted instructions by dominance, as the deletion loop still requires RAUW with undef before deleting. Removing instructions in reverse insertion order should still insure that the number of uselist updates is kept to a minimum.
Diffstat (limited to 'llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
index 3b1e160..d604623 100644
--- a/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
+++ b/llvm/lib/Transforms/Utils/ScalarEvolutionExpander.cpp
@@ -2742,13 +2742,8 @@ void SCEVExpanderCleaner::cleanup() {
// Remove sets with value handles.
Expander.clear();
- // Sort so that earlier instructions do not dominate later instructions.
- stable_sort(InsertedInstructions, [this](Instruction *A, Instruction *B) {
- return DT.dominates(B, A);
- });
// Remove all inserted instructions.
- for (Instruction *I : InsertedInstructions) {
-
+ for (Instruction *I : reverse(InsertedInstructions)) {
#ifndef NDEBUG
assert(all_of(I->users(),
[&InsertedSet](Value *U) {