[llvm] [X86][APX] Convert store(cmov(load(x), y), x) to cstore(y, x) (PR #118946)
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Fri Dec 6 03:41:12 PST 2024
================
@@ -52786,6 +52804,42 @@ static SDValue combineStore(SDNode *N, SelectionDAG &DAG,
}
}
+ // Convert store(cmov(load(x), y), x) to cstore(y, x).
+ if ((VT == MVT::i16 || VT == MVT::i32 || VT == MVT::i64) &&
+ Subtarget.hasCF() && St->isSimple()) {
+ SDValue Cmov;
+ if (StoredVal.getOpcode() == X86ISD::CMOV)
+ Cmov = StoredVal;
+ else if (StoredVal.getOpcode() == ISD::TRUNCATE &&
+ StoredVal.getOperand(0).getOpcode() == X86ISD::CMOV)
+ Cmov = StoredVal.getOperand(0);
+ else
+ return SDValue();
+
+ auto *Ld = dyn_cast<LoadSDNode>(St->getChain());
+ if (!Ld || !Ld->isSimple() || Ld->getBasePtr() != St->getBasePtr())
----------------
RKSimon wrote:
check for ext load?
https://github.com/llvm/llvm-project/pull/118946
More information about the llvm-commits
mailing list