[llvm] [DAGISel][ARM] Fix vector truncate combine for big-endian (PR #118101)

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 3 09:44:39 PST 2024


================
@@ -15495,12 +15495,15 @@ SDValue DAGCombiner::visitTRUNCATE(SDNode *N) {
       unsigned BuildVecNumElts =  BuildVect.getNumOperands();
       unsigned TruncVecNumElts = VT.getVectorNumElements();
       unsigned TruncEltOffset = BuildVecNumElts / TruncVecNumElts;
+      unsigned FirstElt =
+          DAG.getDataLayout().isBigEndian() ? (TruncEltOffset - 1) : 0;
----------------
RKSimon wrote:

visitTRUNCATE already has isLE - replace this with:
```
unsigned FirstElt =isLE ? 0 : (TruncEltOffset - 1);
```

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


More information about the llvm-commits mailing list