[llvm] [InstCombine][DebugInfo] Update debug info after inverting a boolean instruction (PR #71212)

David Blaikie via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 4 10:21:59 PDT 2023


================
@@ -1187,6 +1187,13 @@ void InstCombinerImpl::freelyInvertAllUsersOf(Value *I, Value *IgnoredUser) {
                        "canFreelyInvertAllUsersOf() ?");
     }
   }
+
+  // Adapt all dbg users
+  if (auto *Inst = dyn_cast<Instruction>(I); Inst && Inst->isUsedByMetadata()) {
+    auto *Not = Builder.CreateNot(I);
----------------
dwblaikie wrote:

I don't think we can have debug info create extra instructions, that can lead to codegen variations if debug info is enabled.

I think this needs to be encoded in a DWARF expression, not an IR instruction.

@jmorse is more expert at DWARF location information, though

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


More information about the llvm-commits mailing list