[PATCH] D38197: [DebugInfo] Sort the SDDbgValue list before assuming it is in IR order
Reid Kleckner via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 25 09:14:14 PDT 2017
rnk marked an inline comment as done.
rnk added a comment.
Thanks!
================
Comment at: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp:860
// Sort the source order instructions and use the order to insert debug
// values.
+ std::stable_sort(Orders.begin(), Orders.end(), less_first());
----------------
aprantl wrote:
> Add a comment why the stable_sort is necessary?
I don't have a testcase to demonstrate any issue, but it will ensure that clang has the same output on all platforms regardless of the (usually deterministic) instability in sort order. Anyways, commented.
================
Comment at: llvm/test/DebugInfo/X86/dbg-value-transfer-order.ll:27-39
+; CHECK .LBB0_1: # %while.body
+; CHECK movl $32, %ecx
+; CHECK testl {{.*}}
+; CHECK jne .LBB0_3
+; CHECK # BB#2: # %if.then
+; CHECK callq if_then
+; CHECK movl %eax, %ecx
----------------
Ka-Ka wrote:
> I had problem recreating the fault as this testcase passed both with or without your changes in ScheduleDAGSDNodes.cpp, but then I realized that the checks in these lines don't check anything as they are missing a ':' after the CHECK.
>
Oops. I added the colons and confirmed that the test fails without the sort. Without the fix, the DBG_VALUE for bit_offset appears at the end of `.LBB0_3`.
https://reviews.llvm.org/D38197
More information about the llvm-commits
mailing list