[llvm] [DAG] ExpandOp_NormalStore - check for bitcasted value that has legal store instead of splitting (PR #171478)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 9 12:39:25 PST 2025
================
@@ -479,15 +479,23 @@ SDValue DAGTypeLegalizer::ExpandOp_NormalStore(SDNode *N, unsigned OpNo) {
StoreSDNode *St = cast<StoreSDNode>(N);
assert(!St->isAtomic() && "Atomics can not be split");
- EVT ValueVT = St->getValue().getValueType();
- EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), ValueVT);
SDValue Chain = St->getChain();
+ SDValue Value = St->getValue();
SDValue Ptr = St->getBasePtr();
+ EVT ValueVT = Value.getValueType();
+ EVT NVT = TLI.getTypeToTransformTo(*DAG.getContext(), ValueVT);
AAMDNodes AAInfo = St->getAAInfo();
assert(NVT.isByteSized() && "Expanded type not byte sized!");
unsigned IncrementSize = NVT.getSizeInBits() / 8;
+ // Storing a bitcasted value, see if the original type is a legal store.
+ // TODO: Not necessary if we had proper topological sorting of nodes.
+ if (Value.getOpcode() == ISD::BITCAST &&
+ TLI.isOperationLegal(ISD::STORE, Value.getOperand(0).getValueType()))
----------------
arsenm wrote:
The state of memory instruction legality queries is bad. Does this need to worry about alignment, address space, and everything else?
https://github.com/llvm/llvm-project/pull/171478
More information about the llvm-commits
mailing list