legalization of truncating stores in LegalizeDAG.cpp

In LegalizeDAG.cpp, truncating stores are custom-lowered in line 1314-1317:

1314         case TargetLowering::Custom:
1315           ReplaceNode(SDValue(Node, 0),
1316                       TLI.LowerOperation(SDValue(Node, 0), DAG));
1317           break;

Is there a reason it doesn’t check whether the SDValue returned from
TargetLowering::LowerOperation is null before it replaces the original node with the returned node? The return value is checked everywhere else TLI.LowerOperation is called (line 937, for example).



937         Tmp1 = TLI.LowerOperation(Tmp3, DAG);
938         if (Tmp1.getNode()) {
939           Tmp3 = Tmp1;
940           Tmp4 = Tmp1.getValue(1);
941         }
942         break;

Hi Akira,

Hi Duncan,

It seems that none of the current targets custom-lower truncating stores.

When I added code to do custom-lowering in the Mips backend, the original node gets removed if LowerOperation returns SDValue(). This resulted in an assertion raised when DAGCombiner::visitTokenFactor was executed.

I will add code in LegalizeDAG.cpp to check the returned value later.