From 4a65e6783bee6c155c16944013df8665ec4d4bed Mon Sep 17 00:00:00 2001 From: Danila Malyutin Date: Wed, 14 Dec 2022 13:31:15 +0300 Subject: [PATCH] [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 --- llvm/lib/Transforms/InstCombine/InstructionCombining.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 38a79f0..1d34463 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(PtrOp)) -- 2.7.4