[llvm] [SSAUpdaterBulk] Add PHI simplification pass. (PR #132004)
Valery Pykhtin via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 10 07:08:34 PDT 2025
================
@@ -223,3 +224,78 @@ void SSAUpdaterBulk::RewriteAllUses(DominatorTree *DT,
}
}
}
+
+bool SSAUpdaterBulk::simplifyPass(SmallVectorImpl<PHINode *> &Worklist) {
+ if (Worklist.empty())
+ return false;
+
+ const DataLayout &DL = Worklist.front()->getParent()->getDataLayout();
+ bool Change = false;
+ for (PHINode *&PHI : Worklist) {
+ if (Value *Replacement = simplifyInstruction(PHI, DL)) {
+ PHI->replaceAllUsesWith(Replacement);
+ PHI->eraseFromParent();
+ PHI = nullptr; // Mark as removed
----------------
vpykhtin wrote:
Agree, but I don't see much sense since this is internal routine and we're know what we're doing after that :)
https://github.com/llvm/llvm-project/pull/132004
More information about the llvm-commits
mailing list