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

Adrian Prantl via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 7 07:07:50 PST 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);
----------------
adrian-prantl wrote:

That's right, the presence of debug info may never affect the generated code. You probably want to create a DIExpression that has a DW_OP_not (and potentially modify the Verifier to allow this if this is the first time it's being introduced).

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


More information about the llvm-commits mailing list