mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 07:06:38 +00:00
[KeyInstr][debugify] Add --debugify-atoms to add key instructions metadata
This commit is contained in:
parent
eeb24e30bb
commit
b848c42133
@ -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;
|
||||
|
@ -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]])
|
||||
|
Loading…
x
Reference in New Issue
Block a user