[PATCH] D86689: [DAGCombine] Don't delete the node if it has uses immediately

Qing Shan Zhang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 27 17:37:04 PDT 2020


steven.zhang added inline comments.


================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:5823
       Cost = CostX;
+      SDValue N = DAG.getNode(ISD::FSUB, DL, VT, NegX, Y, Flags);
       RemoveDeadNode(NegY);
----------------
spatel wrote:
> I think it would be clearer and less code duplication to put the 'if' check into the lambda, so something like:
>   auto RemoveDeadNode = [&](SDValue N, SDValue Other) {
>     if (N && N.getNode()->use_empty() && N != Other)
>       DAG.RemoveDeadNode(N.getNode());
>   };
> 
> Then call it with something like this:
>       RemoveDeadNode(NegX, NegY);
> 
we need also check NegX != NegZ...


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86689/new/

https://reviews.llvm.org/D86689



More information about the llvm-commits mailing list