[llvm] [X86][SelectionDAG] Fix the Gather's base and index by modifying the Scale value (PR #134979)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 24 06:28:34 PDT 2025
================
@@ -56520,13 +56520,49 @@ static SDValue combineGatherScatter(SDNode *N, SelectionDAG &DAG,
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
if (DCI.isBeforeLegalize()) {
+ // Attempt to move shifted index into the address scale, allows further
+ // index truncation below.
+ if (Index.getOpcode() == ISD::SHL && isa<ConstantSDNode>(Scale)) {
+ unsigned BitWidth = Index.getScalarValueSizeInBits();
+ unsigned MaskBits = BitWidth - Log2_32(Scale->getAsZExtVal());
----------------
RKSimon wrote:
we should assert that Scale->getAsZExtVal() is pow2
https://github.com/llvm/llvm-project/pull/134979
More information about the llvm-commits
mailing list