[llvm] [DebugInfo][RemoveDIs] Cope with instructions moving after themselves (PR #74113)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 03:15:14 PST 2023


================
@@ -200,8 +200,9 @@ void Instruction::moveBeforeImpl(BasicBlock &BB, InstListType::iterator I,
   // If we've been given the "Preserve" flag, then just move the DPValues with
   // the instruction, no more special handling needed.
   if (BB.IsNewDbgInfoFormat && DbgMarker && !Preserve) {
-    if (I != this->getIterator()) {
-      // "this" is definitely moving; detach any existing DPValues.
+    if (I != this->getIterator() || InsertAtHead) {
+      // "this" is definitely moving in the list, or it's moving ahead of it's
+      // attached DPValues. Detach any existing DPValues.
----------------
OCHyams wrote:

nit "...head of its attached..."

Is this something we want to change in the future, or is there a legitimate use case for this debug shuffling behaviour? If this is purely to match existing weird behaviour then I think it deserves a FIXME.

https://github.com/llvm/llvm-project/pull/74113


More information about the llvm-commits mailing list