diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -2420,8 +2420,7 @@ } NewGEP->insertAt(GEP.getParent(), GEP.getParent()->getFirstInsertionPt()); - replaceOperand(GEP, 0, NewGEP); - PtrOp = NewGEP; + return replaceOperand(GEP, 0, NewGEP); } if (auto *Src = dyn_cast(PtrOp))