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

Danila Malyutin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 14 02:36:53 PST 2022


danilaml created this revision.
Herald added a subscriber: hiraditya.
Herald added a project: All.
danilaml requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D140004

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


Index: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
===================================================================
--- llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ 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<GEPOperator>(PtrOp))


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D140004.482770.patch
Type: text/x-patch
Size: 523 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221214/cd1927e0/attachment.bin>


More information about the llvm-commits mailing list