https://github.com/OCHyams created https://github.com/llvm/llvm-project/pull/133483
None >From b848c421338a93c1d031f3038f81b538eac33aab Mon Sep 17 00:00:00 2001 From: Orlando Cazalet-Hyams <orlando.hy...@sony.com> Date: Mon, 24 Mar 2025 15:53:27 +0000 Subject: [PATCH] [KeyInstr][debugify] Add --debugify-atoms to add key instructions metadata --- llvm/lib/Transforms/Utils/Debugify.cpp | 11 +++++++++-- llvm/test/DebugInfo/debugify.ll | 10 ++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Transforms/Utils/Debugify.cpp b/llvm/lib/Transforms/Utils/Debugify.cpp index e6b5e267d192b..02c7d7f2f10ed 100644 --- a/llvm/lib/Transforms/Utils/Debugify.cpp +++ b/llvm/lib/Transforms/Utils/Debugify.cpp @@ -35,6 +35,8 @@ using namespace llvm; namespace { +cl::opt<bool> ApplyAtomGroups("debugify-atoms", cl::init(false)); + cl::opt<bool> Quiet("debugify-quiet", cl::desc("Suppress verbose debugify output")); @@ -142,8 +144,13 @@ bool llvm::applyDebugifyMetadata( for (BasicBlock &BB : F) { // Attach debug locations. - for (Instruction &I : BB) - I.setDebugLoc(DILocation::get(Ctx, NextLine++, 1, SP)); + for (Instruction &I : BB) { + uint64_t AtomGroup = ApplyAtomGroups ? NextLine : 0; + uint8_t AtomRank = ApplyAtomGroups ? 1 : 0; + uint64_t Line = NextLine++; + I.setDebugLoc(DILocation::get(Ctx, Line, 1, SP, nullptr, false, + AtomGroup, AtomRank)); + } if (DebugifyLevel < Level::LocationsAndVariables) continue; diff --git a/llvm/test/DebugInfo/debugify.ll b/llvm/test/DebugInfo/debugify.ll index 191015f825933..269a301ce830c 100644 --- a/llvm/test/DebugInfo/debugify.ll +++ b/llvm/test/DebugInfo/debugify.ll @@ -1,6 +1,9 @@ ; RUN: opt -passes=debugify -S -o - < %s | FileCheck %s ; RUN: opt -passes=debugify -S -o - < %s | FileCheck %s +; RUN: opt -passes=debugify --debugify-atoms -S -o - < %s \ +; RUN: | FileCheck %s -check-prefixes=CHECK-ATOMS + ; RUN: opt -passes=debugify,debugify -S -o - < %s 2>&1 | \ ; RUN: FileCheck %s -check-prefix=CHECK-REPEAT ; RUN: opt -passes=debugify,debugify -S -o - < %s 2>&1 | \ @@ -101,6 +104,13 @@ define i32 @boom() { ; CHECK-DAG: ![[musttail]] = !DILocation(line: 5, column: 1 ; CHECK-DAG: ![[musttailRes]] = !DILocation(line: 6, column: 1 +; CHECK-ATOMS-DAG: !DILocation(line: 1{{.*}}, atomGroup: 1, atomRank: 1 +; CHECK-ATOMS-DAG: !DILocation(line: 2{{.*}}, atomGroup: 2, atomRank: 1 +; CHECK-ATOMS-DAG: !DILocation(line: 3{{.*}}, atomGroup: 3, atomRank: 1 +; CHECK-ATOMS-DAG: !DILocation(line: 4{{.*}}, atomGroup: 4, atomRank: 1 +; CHECK-ATOMS-DAG: !DILocation(line: 5{{.*}}, atomGroup: 5, atomRank: 1 +; CHECK-ATOMS-DAG: !DILocation(line: 6{{.*}}, atomGroup: 6, atomRank: 1 + ; --- DILocalVariables ; CHECK-DAG: ![[TY32:.*]] = !DIBasicType(name: "ty32", size: 32, encoding: DW_ATE_unsigned) ; CHECK-DAG: !DILocalVariable(name: "1", scope: {{.*}}, file: {{.*}}, line: 1, type: ![[TY32]]) _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits