[llvm] [X86,SimplifyCFG] Use passthru to reduce select (PR #108754)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 02:09:17 PDT 2024


================
@@ -3338,9 +3338,20 @@ bool SimplifyCFGOpt::speculativelyExecuteBB(BranchInst *BI,
     if (auto *LI = dyn_cast<LoadInst>(I)) {
       // Handle Load.
       auto *Ty = I->getType();
-      MaskedLoadStore = Builder.CreateMaskedLoad(FixedVectorType::get(Ty, 1),
-                                                 Op0, LI->getAlign(), Mask);
-      I->replaceAllUsesWith(Builder.CreateBitCast(MaskedLoadStore, Ty));
+      PHINode *PN = nullptr;
+      Value *PassThru = nullptr;
+      for (User *U : I->users())
+        if ((PN = dyn_cast<PHINode>(U))) {
+          PassThru = Builder.CreateBitCast(PN->getIncomingValueForBlock(BB),
+                                           FixedVectorType::get(Ty, 1));
+          break;
----------------
phoebewang wrote:

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

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


More information about the llvm-commits mailing list