[llvm] [LSV] Enhance LoadStoreVectorizer to Handle Disjoint Flag in OR Instructions and Restore Vectorization Opportunities (PR #96495)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 24 08:03:30 PDT 2024


================
@@ -437,9 +437,18 @@ bool Vectorizer::run() {
 
     SmallVector<BasicBlock::iterator, 8> Barriers;
     Barriers.push_back(BB->begin());
-    for (Instruction &I : *BB)
+    for (Instruction &I : *BB){
+      if (auto *OrInst = dyn_cast<PossiblyDisjointInst>(&I)) {
+        Value *Op0 = OrInst->getOperand(0);
+        Value *Op1 = OrInst->getOperand(1);
+
+        if (haveNoCommonBitsSet(Op0, Op1, DL)) {
+          OrInst->setIsDisjoint(true);
----------------
dtcxzyw wrote:

Isn't it handled by `InstCombinerImpl::SimplifyDemandedUseBits`?

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


More information about the llvm-commits mailing list