Pranav Bhandarkar
2012-Aug-31 21:48 UTC
[LLVMdev] Question regarding ReplaceValueWith and ReplaceNodeResults
Hi, I am defining Hexagons version of ReplaceNodeResults to change the a node of the type A: i8 = INTRINSIC_WO_CHAIN ... , ... , To B: SIGN_EXTEND (A) After returning from my function, the type legalizer calss ReplaceValuesUsesWith to replace the uses of A with B. Unfortunately, it replaces the use of A in the new node B too. So the node now is B: SIGN_EXTEND(B) , which is clearly bad and the compiler crashes. In the backend, I tried to create a whole new A, say A` using the operands of A. That didnt work either, because DAG.getNode(INTRINSIC_WO_CHAIN, .. , .., operands of A) returned a memorized version of A itself leading to the same problem. FWIW, ReplaceNodeResults returns new nodes (B in this case) in a vector. Is there something wrong I am doing vis-à-vis the expectations of the SelectionDAG from the backend ? TIA, Pranav Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Eli Friedman
2012-Aug-31 22:01 UTC
[LLVMdev] Question regarding ReplaceValueWith and ReplaceNodeResults
On Fri, Aug 31, 2012 at 2:48 PM, Pranav Bhandarkar <pranavb at codeaurora.org> wrote:> Hi, > > I am defining Hexagons version of ReplaceNodeResults to change the a node of > the type > A: i8 = INTRINSIC_WO_CHAIN ... , ... , > > To > B: SIGN_EXTEND (A) > > After returning from my function, the type legalizerThe type legalizer asked your target to replace an node with an illegal type with a node with a legal type, and your target returned a use of the illegal node. This makes no sense. -Eli
Pranav Bhandarkar
2012-Aug-31 22:14 UTC
[LLVMdev] Question regarding ReplaceValueWith and ReplaceNodeResults
> The type legalizer asked your target to replace an node with an illegaltype> with a node with a legal type, and your target returned a use of theillegal> node. This makes no sense.Aargh, thanks. I did not think of that at all. I confused type legalization with promotion by sign-extension. Thanks, Pranav
Duncan Sands
2012-Sep-01 13:16 UTC
[LLVMdev] Question regarding ReplaceValueWith and ReplaceNodeResults
Hi Pranav,> I am defining Hexagons version of ReplaceNodeResults to change the a node of > the type > A: i8 = INTRINSIC_WO_CHAIN ... , ... , > > To > B: SIGN_EXTEND (A)as well as what Eli said, ReplaceNodeResults requires (IIRC) the new node to have the same type as the old node, which doesn't seem to be the case here. Ciao, Duncan.> > After returning from my function, the type legalizer calss > ReplaceValuesUsesWith to replace the uses of A with B. Unfortunately, it > replaces the use of A in the new node B too. So the node now is > B: SIGN_EXTEND(B) , which is clearly bad and the compiler crashes. > > In the backend, I tried to create a whole new A, say A` using the operands > of A. That didn’t work either, because DAG.getNode(INTRINSIC_WO_CHAIN, .. , > .., operands of A) returned a memorized version of A itself leading to the > same problem. > > FWIW, ReplaceNodeResults returns new nodes (B in this case) in a vector. Is > there something wrong I am doing vis-à-vis the expectations of the > SelectionDAG from the backend ? > > TIA, > Pranav > Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, > hosted by The Linux Foundation > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >
Seemingly Similar Threads
- [LLVMdev] Question regarding ReplaceValueWith and ReplaceNodeResults
- [LLVMdev] Question regarding ReplaceValueWith and ReplaceNodeResults
- [LLVMdev] Question regarding ReplaceValueWith and ReplaceNodeResults
- Handling node through TargetLowering::LowerOperation vs TargetLowering::ReplaceNodeResults
- Handling node through TargetLowering::LowerOperation vs TargetLowering::ReplaceNodeResults