[llvm] [RemoveDIs] Preserve debug info format in llvm-reduce (PR #89220)
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 22 08:07:30 PDT 2024
https://github.com/SLTozer updated https://github.com/llvm/llvm-project/pull/89220
>From 6c3af9a246d89c762b049adf9016abb56dd6123b Mon Sep 17 00:00:00 2001
From: Stephen Tozer <stephen.tozer at sony.com>
Date: Thu, 28 Mar 2024 20:34:31 +0000
Subject: [PATCH 1/2] llvm-reduce stuff
---
llvm/test/tools/llvm-reduce/remove-dp-values.ll | 15 ++++++---------
llvm/tools/llvm-reduce/llvm-reduce.cpp | 15 ++-------------
2 files changed, 8 insertions(+), 22 deletions(-)
diff --git a/llvm/test/tools/llvm-reduce/remove-dp-values.ll b/llvm/test/tools/llvm-reduce/remove-dp-values.ll
index d137b279f4ea01..4a0dfeef204ee0 100644
--- a/llvm/test/tools/llvm-reduce/remove-dp-values.ll
+++ b/llvm/test/tools/llvm-reduce/remove-dp-values.ll
@@ -1,17 +1,14 @@
-; RUN: llvm-reduce --abort-on-invalid-reduction --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t --try-experimental-debuginfo-iterators
-; RUN: FileCheck --check-prefixes=CHECK-FINAL --input-file=%t %s --implicit-check-not=dbg.value
+; RUN: llvm-reduce --abort-on-invalid-reduction --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
+; RUN: FileCheck --check-prefixes=CHECK-FINAL --input-file=%t %s --implicit-check-not=#dbg_value
; Test that we can, in RemoveDIs mode / DbgVariableRecords mode (where variable location
; information isn't an instruction), remove one variable location assignment
; but not another.
-; CHECK-INTERESTINGNESS: call void @llvm.dbg.value(metadata i32 %added,
+; CHECK-INTERESTINGNESS: #dbg_value(i32 %added,
-; CHECK-FINAL: declare void @llvm.dbg.value(metadata,
; CHECK-FINAL: %added = add
-; CHECK-FINAL-NEXT: call void @llvm.dbg.value(metadata i32 %added,
-
-declare void @llvm.dbg.value(metadata, metadata, metadata)
+; CHECK-FINAL-NEXT: #dbg_value(i32 %added,
define i32 @main() !dbg !7 {
entry:
@@ -22,10 +19,10 @@ entry:
store i32 0, ptr %interesting, align 4
%0 = load i32, ptr %interesting, align 4
%added = add nsw i32 %0, 1
- tail call void @llvm.dbg.value(metadata i32 %added, metadata !13, metadata !DIExpression()), !dbg !14
+ #dbg_value(i32 %added, !13, !DIExpression(), !14)
store i32 %added, ptr %interesting, align 4
%alsoloaded = load i32, ptr %interesting, align 4
- tail call void @llvm.dbg.value(metadata i32 %alsoloaded, metadata !13, metadata !DIExpression()), !dbg !14
+ #dbg_value(i32 %alsoloaded, !13, !DIExpression(), !14)
store i32 %alsoloaded, ptr %uninteresting2, align 4
ret i32 0
}
diff --git a/llvm/tools/llvm-reduce/llvm-reduce.cpp b/llvm/tools/llvm-reduce/llvm-reduce.cpp
index f913771487afe1..288a384c2ed498 100644
--- a/llvm/tools/llvm-reduce/llvm-reduce.cpp
+++ b/llvm/tools/llvm-reduce/llvm-reduce.cpp
@@ -100,12 +100,7 @@ static cl::opt<int>
"of delta passes (default=5)"),
cl::init(5), cl::cat(LLVMReduceOptions));
-static cl::opt<bool> TryUseNewDbgInfoFormat(
- "try-experimental-debuginfo-iterators",
- cl::desc("Enable debuginfo iterator positions, if they're built in"),
- cl::init(false));
-
-extern cl::opt<bool> UseNewDbgInfoFormat;
+extern cl::opt<cl::boolOrDefault> PreserveInputDbgFormat;
static codegen::RegisterCodeGenFlags CGF;
@@ -146,17 +141,11 @@ static std::pair<StringRef, bool> determineOutputType(bool IsMIR,
int main(int Argc, char **Argv) {
InitLLVM X(Argc, Argv);
const StringRef ToolName(Argv[0]);
+ PreserveInputDbgFormat = cl::boolOrDefault::BOU_TRUE;
cl::HideUnrelatedOptions({&LLVMReduceOptions, &getColorCategory()});
cl::ParseCommandLineOptions(Argc, Argv, "LLVM automatic testcase reducer.\n");
- // RemoveDIs debug-info transition: tests may request that we /try/ to use the
- // new debug-info format.
- if (TryUseNewDbgInfoFormat) {
- // Turn the new debug-info format on.
- UseNewDbgInfoFormat = true;
- }
-
if (Argc == 1) {
cl::PrintHelpMessage();
return 0;
>From 763f14b8fd15a08089fd20ea3e6021b0d0ff76c3 Mon Sep 17 00:00:00 2001
From: Stephen Tozer <stephen.tozer at sony.com>
Date: Mon, 22 Apr 2024 16:07:13 +0100
Subject: [PATCH 2/2] Update test to cover intrinsics too
---
llvm/test/tools/llvm-reduce/remove-dp-values.ll | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/llvm/test/tools/llvm-reduce/remove-dp-values.ll b/llvm/test/tools/llvm-reduce/remove-dp-values.ll
index 4a0dfeef204ee0..ab9cff4ae76865 100644
--- a/llvm/test/tools/llvm-reduce/remove-dp-values.ll
+++ b/llvm/test/tools/llvm-reduce/remove-dp-values.ll
@@ -1,14 +1,21 @@
; RUN: llvm-reduce --abort-on-invalid-reduction --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
; RUN: FileCheck --check-prefixes=CHECK-FINAL --input-file=%t %s --implicit-check-not=#dbg_value
+; RUN: opt < %s -S --write-experimental-debuginfo=false > %t.intrinsics.ll
+; RUN: llvm-reduce --abort-on-invalid-reduction --test FileCheck --test-arg --check-prefixes=INTRINSIC-INTERESTINGNESS --test-arg %s --test-arg --input-file %t.intrinsics.ll -o %t
+; RUN: FileCheck --check-prefixes=INTRINSIC-FINAL --input-file=%t %s --implicit-check-not=#dbg_value
+
; Test that we can, in RemoveDIs mode / DbgVariableRecords mode (where variable location
; information isn't an instruction), remove one variable location assignment
; but not another.
; CHECK-INTERESTINGNESS: #dbg_value(i32 %added,
+; INTRINSIC-INTERESTINGNESS: llvm.dbg.value(metadata i32 %added,
-; CHECK-FINAL: %added = add
+; CHECK-FINAL: %added = add
; CHECK-FINAL-NEXT: #dbg_value(i32 %added,
+; INTRINSIC-FINAL: %added = add
+; INTRINSIC-FINAL-NEXT: llvm.dbg.value(metadata i32 %added,
define i32 @main() !dbg !7 {
entry:
More information about the llvm-commits
mailing list