Prevent DAG combiner from changing "store ConstFP, addr" to integer store

This code lives in DAGCombiner.cpp:

I haven’t gotten a response on my previous question, below, so I tried the following change to SelectionDAGBuilder.cpp:

@@ -1026,7 +1026,8 @@

return DAG.getConstant(0, TLI.getPointerTy());

if (const ConstantFP *CFP = dyn_cast(C))

  • return DAG.getConstantFP(*CFP, VT);
  • return DAG.getConstantFP(
  • *CFP, VT, TLI.isFPImmLegal(CFP->getValueAPF(), EVT::getEVT(V->getType())));

if (isa(C) && !V->getType()->isAggregateType())
return DAG.getUNDEF(VT);

That is, if FP immediates are ok in the target, generate the constant as a target constant. Is this an acceptable change?