[llvm] cd888e6 - [InstCombine] Fix worklist management in foldPHIArgIntToPtrToPHI()

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 1 01:20:20 PDT 2023


Author: Nikita Popov
Date: 2023-06-01T10:20:12+02:00
New Revision: cd888e6ffef85941836c6c85db9f19d0ac776d1f

URL: https://github.com/llvm/llvm-project/commit/cd888e6ffef85941836c6c85db9f19d0ac776d1f
DIFF: https://github.com/llvm/llvm-project/commit/cd888e6ffef85941836c6c85db9f19d0ac776d1f.diff

LOG: [InstCombine] Fix worklist management in foldPHIArgIntToPtrToPHI()

Make sure the old operand is added back to the worklist for DCE.

Added: 
    

Modified: 
    llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp b/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
index 2565abcffd71e..2f6aa85062a52 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
@@ -316,7 +316,7 @@ Instruction *InstCombinerImpl::foldPHIArgIntToPtrToPHI(PHINode &PN) {
   for (unsigned OpNum = 0; OpNum != PN.getNumIncomingValues(); ++OpNum) {
     if (auto *NewOp =
             simplifyIntToPtrRoundTripCast(PN.getIncomingValue(OpNum))) {
-      PN.setIncomingValue(OpNum, NewOp);
+      replaceOperand(PN, OpNum, NewOp);
       OperandWithRoundTripCast = true;
     }
   }


        


More information about the llvm-commits mailing list