diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp --- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp @@ -16065,6 +16065,9 @@ if (Value.getOpcode() == ISD::TargetConstantFP) return SDValue(); + if (!ISD::isNormalStore(ST)) + return SDValue(); + SDLoc DL(ST); SDValue Chain = ST->getChain(); diff --git a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp --- a/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -421,6 +421,9 @@ } SDValue SelectionDAGLegalize::OptimizeFloatStore(StoreSDNode* ST) { + if (!ISD::isNormalStore(ST)) + return SDValue(); + LLVM_DEBUG(dbgs() << "Optimizing float store operations\n"); // Turn 'store float 1.0, Ptr' -> 'store int 0x12345678, Ptr' // FIXME: We shouldn't do this for TargetConstantFP's.