I need to add a custom DAGNode after a extloadf32. Currently trying to add node within customLowering LowerLoad(possibly not the right approach).
But I keep getting errors and not sure how to accomplish this . What I’m asking is there a correct way to do this or just not possible?
Using this to catch the extloadf32 to a lower operation to lower load:
setLoadExtAction(ISD::EXTLOAD, MVT::f64, MVT::f32, Custom);
Lower Load :
SDValue XXXTargetLowering::LowerLOAD(SDValue Op,SelectionDAG &DAG) const {
SDLoc DL(Op);
LoadSDNode *LoadNode = cast(Op);
SDValue SFTD = DAG.getNode(XXXISD:SFTD, DL, MVT::f64, Op);
DAG.ReplaceAllUsesOfValueWith(Op, SFTD);
return Op;
}
The problem is I’m trying to replace all the uses of the result of the load using ReplaceAllUsesofValue() but then the DAG node for SFTD gets messed up: t17: f64 XXXISD:SFTD t17 as SFTD takes the input “Op”. What’s the correct way to fix the uses but the DAG would be correct.
What I want to accomplish:
t16 : f64,ch = load…
t17 : f64 = XXXISD:SFTD t16
t18 : ch = store… t16:1, t17
What happens:
t16 : f64,ch = load…
t17 : f64 = XXXISD:SFTD t17
t18 : ch = store… t16:1, t17