[llvm] [RemoveDIs] Enable conversion from dbg.declare to DPValue (PR #74090)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 1 07:20:25 PST 2023


https://github.com/OCHyams created https://github.com/llvm/llvm-project/pull/74090

The testing situation here is a little bit difficult. Most of the dbg.declare support patches depend on this patch to be able to test them. However, landing this patch first would result in ~10-15 test failures in tests that already `--try-experimental-debuginfo-iterators` that contain both dbg.values (already fully supported and being tested) and dbg.declares (support in flight: shouldn't really be tested yet - those updates would come as support is added to each pass etc, as we did with dbg.values, if that were possible).

Options:
1) Land this patch first. Remove `--try-experimental-debuginfo-iterators` from those failing tests in this patch, re-add as those passes get dbg.declare support/fixes.
2) Land this patch last. All the dbg.declare-support patches get test updates... but are rotten-green-tests until this patch lands (because the DPValue "declare" path isn't hit without this patch).
3) Squash all the dbg.declare support patches together.

Any strong opinions on the options above? I have listed them in order of personal preference (1 being most preferred), but am happy to go with any as they all have pros & cons.

>From 60437e4e43a63edccd9fa821abb4fb9b93b4bdf1 Mon Sep 17 00:00:00 2001
From: OCHyams <orlando.hyams at sony.com>
Date: Mon, 27 Nov 2023 15:30:49 +0000
Subject: [PATCH] [RemoveDIs] Enable conversion from dbg.declare to DPValue

---
 llvm/lib/IR/BasicBlock.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index 0a8fddbe102538d..eefa46a581f6185 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -73,7 +73,10 @@ void BasicBlock::convertToNewDbgValues() {
   SmallVector<DPValue *, 4> DPVals;
   for (Instruction &I : make_early_inc_range(InstList)) {
     assert(!I.DbgMarker && "DbgMarker already set on old-format instrs?");
-    if (DbgValueInst *DVI = dyn_cast<DbgValueInst>(&I)) {
+    if (DbgVariableIntrinsic *DVI = dyn_cast<DbgVariableIntrinsic>(&I)) {
+      if (isa<DbgAssignIntrinsic>(DVI))
+        continue;
+
       // Convert this dbg.value to a DPValue.
       DPValue *Value = new DPValue(DVI);
       DPVals.push_back(Value);



More information about the llvm-commits mailing list