[LLVMdev] Question regarding ReplaceValueWith and ReplaceNodeResults

Pranav Bhandarkar pranavb at codeaurora.org
Fri Aug 31 14:48:38 PDT 2012


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 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





More information about the llvm-dev mailing list