[llvm] 4a65e67 - [InstCombine] return the result of the GEP of PHI transformation early

Danila Malyutin via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 04:06:21 PST 2022


Author: Danila Malyutin
Date: 2022-12-14T14:56:38+03:00
New Revision: 4a65e6783bee6c155c16944013df8665ec4d4bed

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

LOG: [InstCombine] return the result of the GEP of PHI transformation early

Without this change this function could return nullptr if no further
transformation took place making InstCombine pass incorrectly report no
IR changes preventing analyses invalidation.

Differential Revision: https://reviews.llvm.org/D140004

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 38a79f055e9e..1d344636926e 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -2420,8 +2420,7 @@ Instruction *InstCombinerImpl::visitGetElementPtrInst(GetElementPtrInst &GEP) {
     }
 
     NewGEP->insertAt(GEP.getParent(), GEP.getParent()->getFirstInsertionPt());
-    replaceOperand(GEP, 0, NewGEP);
-    PtrOp = NewGEP;
+    return replaceOperand(GEP, 0, NewGEP);
   }
 
   if (auto *Src = dyn_cast<GEPOperator>(PtrOp))


        


More information about the llvm-commits mailing list