[PATCH] D21037: Preserve DebugInfo when replacing values in DAGCombiner
David Blaikie via llvm-commits
llvm-commits at lists.llvm.org
Mon Jun 6 13:11:45 PDT 2016
Test cases - and also, ideally, it'd be good to find a narrower place to do
this - having to do it in 5 different places/ways seems like we might
easily be missing places (or miss them in the future)?
On Mon, Jun 6, 2016 at 12:53 PM, Nirav Dave via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> niravd created this revision.
> niravd added a reviewer: jyknight.
> niravd added a subscriber: llvm-commits.
>
> [DAG] Previously debug values would transfer debuginfo for the
> selected start node for a replacement which allows for dropped debug
> information. Push debug value transfer to value replacement.
>
> http://reviews.llvm.org/D21037
>
> Files:
> lib/CodeGen/SelectionDAG/DAGCombiner.cpp
> lib/CodeGen/SelectionDAG/SelectionDAG.cpp
>
> Index: lib/CodeGen/SelectionDAG/SelectionDAG.cpp
> ===================================================================
> --- lib/CodeGen/SelectionDAG/SelectionDAG.cpp
> +++ lib/CodeGen/SelectionDAG/SelectionDAG.cpp
> @@ -6359,6 +6359,9 @@
> AddModifiedNodeToCSEMaps(User);
> }
>
> + // Preserve Debug Values
> + TransferDbgValues(FromN, To);
> +
> // If we just RAUW'd the root, take note.
> if (FromN == getRoot())
> setRoot(To);
> @@ -6382,6 +6385,11 @@
> if (From == To)
> return;
>
> + // Preserve Debug Info. Only do this if there's a use.
> + for (unsigned i = 0, e = From->getNumValues(); i != e; ++i)
> + if (From->hasAnyUseOfValue(i))
> + TransferDbgValues(SDValue(From, i), SDValue(To, i));
> +
> // Iterate over just the existing users of From. See the comments in
> // the ReplaceAllUsesWith above.
> SDNode::use_iterator UI = From->use_begin(), UE = From->use_end();
> @@ -6421,6 +6429,10 @@
> if (From->getNumValues() == 1) // Handle the simple case efficiently.
> return ReplaceAllUsesWith(SDValue(From, 0), To[0]);
>
> + // Preserve Debug Info.
> + for (unsigned i = 0, e = From->getNumValues(); i != e; ++i)
> + TransferDbgValues(SDValue(From, i), *To);
> +
> // Iterate over just the existing users of From. See the comments in
> // the ReplaceAllUsesWith above.
> SDNode::use_iterator UI = From->use_begin(), UE = From->use_end();
> @@ -6508,6 +6520,9 @@
> AddModifiedNodeToCSEMaps(User);
> }
>
> + // Preserve Debug Info.
> + TransferDbgValues(From, To);
> +
> // If we just RAUW'd the root, take note.
> if (From == getRoot())
> setRoot(To);
> @@ -6539,6 +6554,8 @@
> if (Num == 1)
> return ReplaceAllUsesOfValueWith(*From, *To);
>
> + TransferDbgValues(*From, *To);
> +
> // Read up all the uses and make records of them. This helps
> // processing new uses that are introduced during the
> // replacement process.
> Index: lib/CodeGen/SelectionDAG/DAGCombiner.cpp
> ===================================================================
> --- lib/CodeGen/SelectionDAG/DAGCombiner.cpp
> +++ lib/CodeGen/SelectionDAG/DAGCombiner.cpp
> @@ -1331,8 +1331,6 @@
> DEBUG(dbgs() << " ... into: ";
> RV.getNode()->dump(&DAG));
>
> - // Transfer debug value.
> - DAG.TransferDbgValues(SDValue(N, 0), RV);
> if (N->getNumValues() == RV.getNode()->getNumValues())
> DAG.ReplaceAllUsesWith(N, RV.getNode());
> else {
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160606/bbdd192f/attachment.html>
More information about the llvm-commits
mailing list