[llvm] [RISCV] Improve performCONCAT_VECTORCombine stride matching (PR #68726)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 16 06:27:57 PDT 2023


================
@@ -13804,6 +13805,16 @@ static SDValue performCONCAT_VECTORSCombine(SDNode *N, SelectionDAG &DAG,
   }
 
   auto getPtrDiff = [&DAG, &DL](LoadSDNode *Ld1, LoadSDNode *Ld2) {
+    // If the load ptrs can be decomposed into a common (Base + Index) with a
+    // common constant stride, then return the constant stride.
+    BaseIndexOffset BIO1 = BaseIndexOffset::match(Ld1, DAG);
+    BaseIndexOffset BIO2 = BaseIndexOffset::match(Ld2, DAG);
+    if (BIO1.hasValidOffset() && BIO2.hasValidOffset() &&
+        BIO1.equalBaseIndex(BIO2, DAG))
----------------
lukel97 wrote:

Looks like `equalBaseIndex` already checks for `hasValidOffset` on both operands, can we remove the checks here

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


More information about the llvm-commits mailing list