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

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 15 08:05:41 PDT 2024


================
@@ -3335,12 +3335,21 @@ bool SimplifyCFGOpt::speculativelyExecuteBB(BranchInst *BI,
     assert(!getLoadStoreType(I)->isVectorTy() && "not implemented");
     auto *Op0 = I->getOperand(0);
     Instruction *MaskedLoadStore = nullptr;
+    PHINode *PN = nullptr;
     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));
+      Value *PassThru = nullptr;
+      if (I->hasOneUse())
+        if ((PN = dyn_cast<PHINode>(I->use_begin()->getUser())))
----------------
dtcxzyw wrote:

https://llvm.org/docs/CodingStandards.html#treat-compiler-warnings-like-errors

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


More information about the llvm-commits mailing list