[llvm] [DFAJumpThreading] Only unfold select coming from directly where it is defined (PR #70966)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 2 05:09:37 PDT 2023
================
@@ -460,6 +461,11 @@ struct MainSwitch {
BasicBlock *SIBB = SI->getParent();
+ // Only fold the select coming from directly where it is defined.
+ PHINode *PHIUser = dyn_cast<PHINode>(SIUse);
+ if (PHIUser && PHIUser->getIncomingBlock(*SI->use_begin()) != SIBB)
+ return false;
----------------
nikic wrote:
There is a `SIBB->getSingleSuccessor() != cast<Instruction>(SIUse)->getParent()` check a few lines below -- can it be dropped now? I think it had the same purpose, but did not account for the loop entry case.
https://github.com/llvm/llvm-project/pull/70966
More information about the llvm-commits
mailing list