[llvm] [X86] EltsFromConsecutiveLoads - recognise reverse load patterns. (PR #168706)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 19 06:28:25 PST 2025


================
@@ -7557,6 +7557,19 @@ static SDValue EltsFromConsecutiveLoads(EVT VT, ArrayRef<SDValue> Elts,
     }
   }
 
+  // REVERSE - attempt to match the loads in reverse and then shuffle back.
+  // TODO: Do this for any permute or mismatching element counts.
+  if (Depth == 0 && !ZeroMask && TLI.isTypeLegal(VT) && VT.isVector() &&
+      NumElems == VT.getVectorNumElements()) {
+    SmallVector<SDValue, 4> ReverseElts(Elts.rbegin(), Elts.rend());
----------------
RKSimon wrote:

Nice catch

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


More information about the llvm-commits mailing list