[llvm] [X86][SelectionDAG] Fix the Gather's base and index by modifying the Scale value (PR #137813)
Rohit Aggarwal via llvm-commits
llvm-commits at lists.llvm.org
Mon May 5 00:31:15 PDT 2025
================
@@ -56604,11 +56640,25 @@ static SDValue combineGatherScatter(SDNode *N, SelectionDAG &DAG,
Index = DAG.getNode(ISD::TRUNCATE, DL, NewVT, Index);
return rebuildGatherScatter(GorS, Index, Base, Scale, DAG);
}
+
+ // Shrink if we remove an illegal type.
+ if (!TLI.isTypeLegal(Index.getValueType()) && TLI.isTypeLegal(NewVT)) {
+ Index = DAG.getNode(ISD::TRUNCATE, DL, NewVT, Index);
+ return rebuildGatherScatter(GorS, Index, Base, Scale, DAG);
+ }
}
}
EVT PtrVT = TLI.getPointerTy(DAG.getDataLayout());
+ // if (Index.getOpcode() == ISD::SHL) {
+ // unsigned BitWidth = Index.getScalarValueSizeInBits();
+ // unsigned MaskBits = BitWidth - Log2_32(Scale->getAsZExtVal());
+ // APInt DemandedBits = APInt::getLowBitsSet(BitWidth, MaskBits);
+ // if (TLI.SimplifyDemandedBits(Index, DemandedBits, DCI)) {
+ // return SDValue(N, 0);
+ // }
+ // }
----------------
rohitaggarwal007 wrote:
Done
https://github.com/llvm/llvm-project/pull/137813
More information about the llvm-commits
mailing list