[llvm] 8735780 - [InstCombine] Use replaceOperand() in non zero phi transform

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 31 12:55:24 PDT 2020


Author: Nikita Popov
Date: 2020-03-31T21:54:21+02:00
New Revision: 87357808b807a9270153702975872cab1a569db6

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

LOG: [InstCombine] Use replaceOperand() in non zero phi transform

To make sure the old operand gets DCEd.

NFC apart from worklist order changes.

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 9cdb68d07aa1..4f6a6443b00f 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp
@@ -1203,7 +1203,7 @@ Instruction *InstCombiner::visitPHINode(PHINode &PN) {
             NonZeroConst = GetAnyNonZeroConstInt(PN);
 
           if (NonZeroConst != VA) {
-            PN.setIncomingValue(i, NonZeroConst);
+            replaceOperand(PN, i, NonZeroConst);
             MadeChange = true;
           }
         }


        


More information about the llvm-commits mailing list