[LLVMdev] Lowering to return multiple values: codeGen, instruction write one value to the input register.

Tim Northover t.p.northover at gmail.com
Sat Jul 12 01:31:19 PDT 2014


> so my plan is to lower it like the following when I see the “sincos(v4f32)” node.
>> SDValue sin  = DAG.getNode(my_ISD::sin, DL, VT, Op.getOperand(0);
> SDValue cos = DAG.getNode(my_ISD::cos, DL, VT, Op.getOperand(0);
>
> SDValue sinVal = DAG.getNode(ISD::BUILD_VECTOR, DL, MVT::v4f32, sin, sin, sin, sin);
> SDValue cosVal = DAG.getNode(ISD::BUILD_VECTOR, DL, MVT::v4f32, cos, cos, cos, cos);
>
> SDValue results[] = {sinVal, cosVal};
> return DAG.getMergeValues(results, 2, DL);
> "
>
> So in a test, I am expecting  the my_sincos(v4f32) node should appears
> have two return values in view-dag-combine1-dags even I am using only
> sinVal.

The code looks reasonable in isolation. But I wouldn't expect this to
show up in dag-combine1-dags: that's before even type legalization
happens. Very little of your custom lowering code will have run at
that stage (function arg/return values only, pretty much).

Perhaps try attaching a debugger and calling DAG.viewGraph() manually
just after your code has run.

Cheers.

Tim.




More information about the llvm-dev mailing list