[llvm] [DFAJumpThreading] Only unfold select coming from directly where it is defined (PR #70966)

via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 2 05:41:23 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;
----------------
XChy wrote:

Thanks, I didn't notice it.

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


More information about the llvm-commits mailing list