[llvm] r269236 - SDAG: Add a helper to replace and remove a node during ISel

Meador Inge via llvm-commits llvm-commits at lists.llvm.org
Wed May 11 14:59:30 PDT 2016


On Wed, May 11, 2016 at 4:13 PM, Justin Bogner via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

Author: bogner
> Date: Wed May 11 16:13:17 2016
> New Revision: 269236
>
> URL: http://llvm.org/viewvc/llvm-project?rev=269236&view=rev
> Log:
> SDAG: Add a helper to replace and remove a node during ISel
>
> It's very common to want to replace a node and then remove it since
> it's dead, especially as we port backends from the SDNode *Select API
> to the void Select one. This helper makes this sequence a bit less
> verbose.
>

I don't fully understand the context, but ...


> -    ReplaceUses(SDValue(Node, 0), SDValue(CNode, 0));
> -    ReplaceUses(SDValue(Node, 1), SDValue(CNode, 1));
> +    ReplaceNode(Node, CNode);
>

... this replaced sequence and ....


> @@ -2152,9 +2150,7 @@ void X86DAGToDAGISel::Select(SDNode *Nod
>      SDValue Ops[] = {N1, InFlag};
>      SDNode *CNode = CurDAG->getMachineNode(Opc, dl, VTs, Ops);
>
> -    ReplaceUses(SDValue(Node, 0), SDValue(CNode, 0));
> -    ReplaceUses(SDValue(Node, 1), SDValue(CNode, 1));
> -    ReplaceUses(SDValue(Node, 2), SDValue(CNode, 2));
> +    ReplaceUses(Node, CNode);
>

... this replaced sequence seem the same, but the latter wasn't
modified to use `ReplaceNode`.  Should it have been?

-- Meador
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160511/2b0cd95e/attachment.html>


More information about the llvm-commits mailing list