[llvm] [DFAJumpThreading] Unfold select to the incoming block of phi user (PR #160987)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 1 00:46:39 PDT 2025


================
@@ -190,12 +190,12 @@ void unfold(DomTreeUpdater *DTU, LoopInfo *LI, SelectInstToUnfold SIToUnfold,
             std::vector<BasicBlock *> *NewBBs) {
   SelectInst *SI = SIToUnfold.getInst();
   PHINode *SIUse = SIToUnfold.getUse();
-  BasicBlock *StartBlock = SI->getParent();
+  assert(SI->hasOneUse());
+  // The select may come indirectly, instead of from where it is defined.
+  BasicBlock *StartBlock = SIUse->getIncomingBlock(SI->user_begin().getUse());
----------------
nikic wrote:

`use_begin()` instead of `user_begin().getUse()`?

https://github.com/llvm/llvm-project/pull/160987


More information about the llvm-commits mailing list