[llvm] DAG: Simplify demanded bits for truncating atomic_store (PR #90113)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 26 03:22:36 PDT 2024
================
@@ -21096,6 +21098,24 @@ SDValue DAGCombiner::replaceStoreOfInsertLoad(StoreSDNode *ST) {
ST->getMemOperand()->getFlags());
}
+SDValue DAGCombiner::visitATOMIC_STORE(SDNode *N) {
+ AtomicSDNode *ST = cast<AtomicSDNode>(N);
+ SDValue Val = ST->getVal();
+ EVT VT = Val.getValueType();
+ EVT MemVT = ST->getMemoryVT();
+
+ if (MemVT.bitsLT(VT)) { // Is truncating store
+ APInt TruncDemandedBits = APInt::getLowBitsSet(VT.getScalarSizeInBits(),
+ MemVT.getScalarSizeInBits());
+ // See if we can simplify the operation with SimplifyDemandedBits, which
+ // only works if the value has a single use.
+ if (SimplifyDemandedBits(Val, TruncDemandedBits))
----------------
arsenm wrote:
The comments there suggest it's due to merge optimizations triggering, which I assumed don't apply for the atomic case. It's probably not important to revisit these aggressively in any case
https://github.com/llvm/llvm-project/pull/90113
More information about the llvm-commits
mailing list