[llvm] DAG: Simplify demanded bits for truncating atomic_store (PR #90113)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 26 02:02:22 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))
----------------
jayfoad wrote:
Do you need any of the worklist fiddling that the corresponding code in visitSTORE does?
https://github.com/llvm/llvm-project/pull/90113
More information about the llvm-commits
mailing list