Hi I am running into a legalize dag issue after custom lowering a load. If someone can give me pointers that would be great. I am using llvm 2.6 When custom lowering a load, the following code gets executed. Tmp1 = TLI.LowerOperation(Tmp3, DAG); if (Tmp1.getNode()) { Tmp3 = LegalizeOp(Tmp1); Tmp4 = LegalizeOp(Tmp1.getValue(1)); <----------------- what is the value expected } What is the value supposed to legalized by the second call to legalizeOp. ? My problem is that the second call asserts inside legalize ops at ResultVals[Op.getResNo()]; b'cos ResultVals has only 1 element and Op.resno is 0. I am not sure if I provided enough context. Please let me know if more information is needed. thanks shrey
Correction: I meant Op.resno is 1 - so out of bounds assert shrey On Thu, Nov 12, 2009 at 4:12 PM, shreyas krishnan <shreyas76 at gmail.com> wrote:> Hi > I am running into a legalize dag issue after custom lowering a > load. If someone can give me pointers that would be great. I am using > llvm 2.6 > > When custom lowering a load, the following code gets executed. > > Tmp1 = TLI.LowerOperation(Tmp3, DAG); > if (Tmp1.getNode()) { > Tmp3 = LegalizeOp(Tmp1); > Tmp4 = LegalizeOp(Tmp1.getValue(1)); <----------------- what > is the value expected > } > > > What is the value supposed to legalized by the second call to legalizeOp. ? > > My problem is that the second call asserts inside legalize ops at > ResultVals[Op.getResNo()]; b'cos ResultVals has only 1 element and > Op.resno is 0. > > I am not sure if I provided enough context. Please let me know if more > information is needed. > > thanks > shrey >
> My problem is that the second call asserts inside legalize ops at > ResultVals[Op.getResNo()]; b'cos ResultVals has only 1 element and > Op.resno is 0.Looks like you lowered the load improperly. It should return 2 values: the value loaded and a chain. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
thanks for the help ..I do add the chain and the result. My code is like this ... SDValue Ops[] = { load->getChain(), load->getOperand(1), load->getBasePtr(), des }; DAG.getNode(CustomOpc, NodeTys, Ops, 4); thanks again! shrey On Thu, Nov 12, 2009 at 4:41 PM, Anton Korobeynikov <anton at korobeynikov.info> wrote:>> My problem is that the second call asserts inside legalize ops at >> ResultVals[Op.getResNo()]; b'cos ResultVals has only 1 element and >> Op.resno is 0. > Looks like you lowered the load improperly. It should return 2 values: > the value loaded and a chain. > > -- > With best regards, Anton Korobeynikov > Faculty of Mathematics and Mechanics, Saint Petersburg State University >