[PATCH] D68128: [InstCombine] Fold PHIs with equal incoming pointers

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 1 02:30:08 PDT 2019


lebedev.ri added a comment.

I see.
So we want to hoist identical gep+bitcast from 2 BB's into their closest dominating BB, more or less.
Do we have standalone hoisting pass?



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombinePHI.cpp:1157-1168
+  Instruction *InsertPt = nullptr;
+  if (auto *BaseInst = dyn_cast<Instruction>(Base)) {
+    if (isa<PHINode>(BaseInst)) {
+      BasicBlock *InsertBB = BaseInst->getParent();
+      BasicBlock::iterator InsertPtIter = InsertBB->getFirstInsertionPt();
+      // Make sure the insertion point exists.
+      if (InsertPtIter != InsertBB->end())
----------------
I'm not sure if this is correct.
I'd expect that we actually need to check to where we can move these geps.



CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68128/new/

https://reviews.llvm.org/D68128





More information about the llvm-commits mailing list