[PATCH] D38197: [DebugInfo] Sort the SDDbgValue list before assuming it is in IR order

Adrian Prantl via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 25 08:48:01 PDT 2017


aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

Thanks! It might be good to separate the refactoring into an NFC commit.



================
Comment at: llvm/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp:755
 
-  Orders.push_back(std::make_pair(Order, &*std::prev(Emitter.getInsertPos())));
+  Orders.push_back(std::make_pair(Order, &*std::prev(IP)));
   ProcessSDDbgValues(N, DAG, Emitter, Orders, VRBaseMap, Order);
----------------
`Orders.push_back({Order, &*std::prev(IP)});`


================
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());
----------------
Add a comment why the stable_sort is necessary?


https://reviews.llvm.org/D38197





More information about the llvm-commits mailing list