[llvm] [SCEVExp] Add helper to clean up dead instructions after expansion. (PR #157308)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 8 01:26:30 PDT 2025


================
@@ -175,6 +176,16 @@ SCEVExpander::findInsertPointAfter(Instruction *I,
   return IP;
 }
 
+void SCEVExpander::eraseDeadInstructions(Value *Root) {
+  for (Instruction *I : getAllInsertedInstructions()) {
----------------
fhahn wrote:

I switched to a worklist, as the inserted values are stored in DenseSets to make sure there's no differences based on the iteration order over the sets

https://github.com/llvm/llvm-project/pull/157308


More information about the llvm-commits mailing list