1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00

Parse and print DIExpressions inline to ease IR and MIR testing

Summary:
Most DIExpressions are empty or very simple. When they are complex, they
tend to be unique, so checking them inline is reasonable.

This also avoids the need for CodeGen passes to append to the
llvm.dbg.mir named md node.

See also PR22780, for making DIExpression not be an MDNode.

Reviewers: aprantl, dexonsmith, dblaikie

Subscribers: qcolombet, javed.absar, eraman, hiraditya, llvm-commits

Differential Revision: https://reviews.llvm.org/D37075

llvm-svn: 311594
This commit is contained in:
Reid Kleckner 2017-08-23 20:31:27 +00:00
parent b2307c41ea
commit 67886a34d2
48 changed files with 336 additions and 288 deletions

View File

@ -643,11 +643,18 @@ bool LLParser::ParseNamedMetadata() {
NamedMDNode *NMD = M->getOrInsertNamedMetadata(Name); NamedMDNode *NMD = M->getOrInsertNamedMetadata(Name);
if (Lex.getKind() != lltok::rbrace) if (Lex.getKind() != lltok::rbrace)
do { do {
if (ParseToken(lltok::exclaim, "Expected '!' here"))
return true;
MDNode *N = nullptr; MDNode *N = nullptr;
if (ParseMDNodeID(N)) return true; // Parse DIExpressions inline as a special case. They are still MDNodes,
// so they can still appear in named metadata. Remove this logic if they
// become plain Metadata.
if (Lex.getKind() == lltok::MetadataVar &&
Lex.getStrVal() == "DIExpression") {
if (ParseDIExpression(N, /*IsDistinct=*/false))
return true;
} else if (ParseToken(lltok::exclaim, "Expected '!' here") ||
ParseMDNodeID(N)) {
return true;
}
NMD->addOperand(N); NMD->addOperand(N);
} while (EatIfPresent(lltok::comma)); } while (EatIfPresent(lltok::comma));

View File

@ -490,6 +490,7 @@ static MIToken::TokenKind getMetadataKeywordKind(StringRef Identifier) {
.Case("!alias.scope", MIToken::md_alias_scope) .Case("!alias.scope", MIToken::md_alias_scope)
.Case("!noalias", MIToken::md_noalias) .Case("!noalias", MIToken::md_noalias)
.Case("!range", MIToken::md_range) .Case("!range", MIToken::md_range)
.Case("!DIExpression", MIToken::md_diexpr)
.Default(MIToken::Error); .Default(MIToken::Error);
} }

View File

@ -100,6 +100,7 @@ struct MIToken {
md_alias_scope, md_alias_scope,
md_noalias, md_noalias,
md_range, md_range,
md_diexpr,
// Identifier tokens // Identifier tokens
Identifier, Identifier,

View File

@ -39,6 +39,7 @@
#include "llvm/IR/BasicBlock.h" #include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Constants.h" #include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h" #include "llvm/IR/DataLayout.h"
#include "llvm/IR/DebugInfoMetadata.h"
#include "llvm/IR/DebugLoc.h" #include "llvm/IR/DebugLoc.h"
#include "llvm/IR/Function.h" #include "llvm/IR/Function.h"
#include "llvm/IR/InstrTypes.h" #include "llvm/IR/InstrTypes.h"
@ -209,6 +210,7 @@ public:
bool parseJumpTableIndexOperand(MachineOperand &Dest); bool parseJumpTableIndexOperand(MachineOperand &Dest);
bool parseExternalSymbolOperand(MachineOperand &Dest); bool parseExternalSymbolOperand(MachineOperand &Dest);
bool parseMDNode(MDNode *&Node); bool parseMDNode(MDNode *&Node);
bool parseDIExpression(MDNode *&Node);
bool parseMetadataOperand(MachineOperand &Dest); bool parseMetadataOperand(MachineOperand &Dest);
bool parseCFIOffset(int &Offset); bool parseCFIOffset(int &Offset);
bool parseCFIRegister(unsigned &Reg); bool parseCFIRegister(unsigned &Reg);
@ -854,10 +856,14 @@ bool MIParser::parseStandaloneStackObject(int &FI) {
bool MIParser::parseStandaloneMDNode(MDNode *&Node) { bool MIParser::parseStandaloneMDNode(MDNode *&Node) {
lex(); lex();
if (Token.isNot(MIToken::exclaim)) if (Token.is(MIToken::exclaim)) {
if (parseMDNode(Node))
return true;
} else if (Token.is(MIToken::md_diexpr)) {
if (parseDIExpression(Node))
return true;
} else
return error("expected a metadata node"); return error("expected a metadata node");
if (parseMDNode(Node))
return true;
if (Token.isNot(MIToken::Eof)) if (Token.isNot(MIToken::Eof))
return error("expected end of string after the metadata node"); return error("expected end of string after the metadata node");
return false; return false;
@ -1492,6 +1498,7 @@ bool MIParser::parseSubRegisterIndexOperand(MachineOperand &Dest) {
bool MIParser::parseMDNode(MDNode *&Node) { bool MIParser::parseMDNode(MDNode *&Node) {
assert(Token.is(MIToken::exclaim)); assert(Token.is(MIToken::exclaim));
auto Loc = Token.location(); auto Loc = Token.location();
lex(); lex();
if (Token.isNot(MIToken::IntegerLiteral) || Token.integerValue().isSigned()) if (Token.isNot(MIToken::IntegerLiteral) || Token.integerValue().isSigned())
@ -1507,10 +1514,56 @@ bool MIParser::parseMDNode(MDNode *&Node) {
return false; return false;
} }
bool MIParser::parseDIExpression(MDNode *&Expr) {
assert(Token.is(MIToken::md_diexpr));
lex();
// FIXME: Share this parsing with the IL parser.
SmallVector<uint64_t, 8> Elements;
if (expectAndConsume(MIToken::lparen))
return true;
if (Token.isNot(MIToken::rparen)) {
do {
if (Token.is(MIToken::Identifier)) {
if (unsigned Op = dwarf::getOperationEncoding(Token.stringValue())) {
lex();
Elements.push_back(Op);
continue;
}
return error(Twine("invalid DWARF op '") + Token.stringValue() + "'");
}
if (Token.isNot(MIToken::IntegerLiteral) ||
Token.integerValue().isSigned())
return error("expected unsigned integer");
auto &U = Token.integerValue();
if (U.ugt(UINT64_MAX))
return error("element too large, limit is " + Twine(UINT64_MAX));
Elements.push_back(U.getZExtValue());
lex();
} while (consumeIfPresent(MIToken::comma));
}
if (expectAndConsume(MIToken::rparen))
return true;
Expr = DIExpression::get(MF.getFunction()->getContext(), Elements);
return false;
}
bool MIParser::parseMetadataOperand(MachineOperand &Dest) { bool MIParser::parseMetadataOperand(MachineOperand &Dest) {
MDNode *Node = nullptr; MDNode *Node = nullptr;
if (parseMDNode(Node)) if (Token.is(MIToken::exclaim)) {
return true; if (parseMDNode(Node))
return true;
} else if (Token.is(MIToken::md_diexpr)) {
if (parseDIExpression(Node))
return true;
}
Dest = MachineOperand::CreateMetadata(Node); Dest = MachineOperand::CreateMetadata(Node);
return false; return false;
} }
@ -1851,6 +1904,7 @@ bool MIParser::parseMachineOperand(MachineOperand &Dest,
return parseExternalSymbolOperand(Dest); return parseExternalSymbolOperand(Dest);
case MIToken::SubRegisterIndex: case MIToken::SubRegisterIndex:
return parseSubRegisterIndexOperand(Dest); return parseSubRegisterIndexOperand(Dest);
case MIToken::md_diexpr:
case MIToken::exclaim: case MIToken::exclaim:
return parseMetadataOperand(Dest); return parseMetadataOperand(Dest);
case MIToken::kw_cfi_same_value: case MIToken::kw_cfi_same_value:

View File

@ -1046,6 +1046,10 @@ void SlotTracker::CreateFunctionSlot(const Value *V) {
void SlotTracker::CreateMetadataSlot(const MDNode *N) { void SlotTracker::CreateMetadataSlot(const MDNode *N) {
assert(N && "Can't insert a null Value into SlotTracker!"); assert(N && "Can't insert a null Value into SlotTracker!");
// Don't make slots for DIExpressions. We just print them inline everywhere.
if (isa<DIExpression>(N))
return;
unsigned DestSlot = mdnNext; unsigned DestSlot = mdnNext;
if (!mdnMap.insert(std::make_pair(N, DestSlot)).second) if (!mdnMap.insert(std::make_pair(N, DestSlot)).second)
return; return;
@ -2073,6 +2077,13 @@ static void WriteAsOperandInternal(raw_ostream &Out, const Metadata *MD,
TypePrinting *TypePrinter, TypePrinting *TypePrinter,
SlotTracker *Machine, const Module *Context, SlotTracker *Machine, const Module *Context,
bool FromValue) { bool FromValue) {
// Write DIExpressions inline when used as a value. Improves readability of
// debug info intrinsics.
if (const DIExpression *Expr = dyn_cast<DIExpression>(MD)) {
writeDIExpression(Out, Expr, TypePrinter, Machine, Context);
return;
}
if (const MDNode *N = dyn_cast<MDNode>(MD)) { if (const MDNode *N = dyn_cast<MDNode>(MD)) {
std::unique_ptr<SlotTracker> MachineStorage; std::unique_ptr<SlotTracker> MachineStorage;
if (!Machine) { if (!Machine) {
@ -2424,7 +2435,16 @@ void AssemblyWriter::printNamedMDNode(const NamedMDNode *NMD) {
for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) { for (unsigned i = 0, e = NMD->getNumOperands(); i != e; ++i) {
if (i) if (i)
Out << ", "; Out << ", ";
int Slot = Machine.getMetadataSlot(NMD->getOperand(i));
// Write DIExpressions inline.
// FIXME: Ban DIExpressions in NamedMDNodes, they will serve no purpose.
MDNode *Op = NMD->getOperand(i);
if (auto *Expr = dyn_cast<DIExpression>(Op)) {
writeDIExpression(Out, Expr, nullptr, nullptr, nullptr);
continue;
}
int Slot = Machine.getMetadataSlot(Op);
if (Slot == -1) if (Slot == -1)
Out << "<badref>"; Out << "<badref>";
else else

View File

@ -3,7 +3,7 @@
@foo = global i32 0 @foo = global i32 0
; CHECK: !named = !{!0, !1, !2, !3, !4, !5, !6, !7} ; CHECK: !named = !{!0, !1, !2, !3, !4, !5, !6, !DIExpression(DW_OP_constu, 42, DW_OP_stack_value)}
!named = !{!0, !1, !2, !3, !4, !5, !6, !7} !named = !{!0, !1, !2, !3, !4, !5, !6, !7}
!0 = !DIFile(filename: "scope.h", directory: "/path/to/dir") !0 = !DIFile(filename: "scope.h", directory: "/path/to/dir")
@ -17,7 +17,6 @@
file: !2, line: 7, type: !3, isLocal: true, file: !2, line: 7, type: !3, isLocal: true,
isDefinition: false, align: 32) isDefinition: false, align: 32)
; CHECK: !6 = !DIGlobalVariableExpression(var: !5, expr: !7) ; CHECK: !6 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression(DW_OP_constu, 42, DW_OP_stack_value))
!6 = !DIGlobalVariableExpression(var: !5, expr: !7) !6 = !DIGlobalVariableExpression(var: !5, expr: !7)
; CHECK: !7 = !DIExpression(DW_OP_constu, 42, DW_OP_stack_value)
!7 = !DIExpression(DW_OP_constu, 42, DW_OP_stack_value) !7 = !DIExpression(DW_OP_constu, 42, DW_OP_stack_value)

View File

@ -1,16 +1,17 @@
; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s ; RUN: llvm-as < %s | llvm-dis | llvm-as | llvm-dis | FileCheck %s
; RUN: verify-uselistorder %s ; RUN: verify-uselistorder %s
; CHECK: !named = !{!0, !1, !2, !3, !4, !5, !6} ; CHECK: !named = !{
; CHECK-SAME: !DIExpression(),
; CHECK-SAME: !DIExpression(DW_OP_deref),
; CHECK-SAME: !DIExpression(DW_OP_constu, 3, DW_OP_plus),
; CHECK-SAME: !DIExpression(DW_OP_LLVM_fragment, 3, 7),
; CHECK-SAME: !DIExpression(DW_OP_deref, DW_OP_plus_uconst, 3, DW_OP_LLVM_fragment, 3, 7),
; CHECK-SAME: !DIExpression(DW_OP_constu, 2, DW_OP_swap, DW_OP_xderef),
; CHECK-SAME: !DIExpression(DW_OP_plus_uconst, 3)}
!named = !{!0, !1, !2, !3, !4, !5, !6} !named = !{!0, !1, !2, !3, !4, !5, !6}
; CHECK: !0 = !DIExpression()
; CHECK-NEXT: !1 = !DIExpression(DW_OP_deref)
; CHECK-NEXT: !2 = !DIExpression(DW_OP_constu, 3, DW_OP_plus)
; CHECK-NEXT: !3 = !DIExpression(DW_OP_LLVM_fragment, 3, 7)
; CHECK-NEXT: !4 = !DIExpression(DW_OP_deref, DW_OP_plus_uconst, 3, DW_OP_LLVM_fragment, 3, 7)
; CHECK-NEXT: !5 = !DIExpression(DW_OP_constu, 2, DW_OP_swap, DW_OP_xderef)
; CHECK-NEXT: !6 = !DIExpression(DW_OP_plus_uconst, 3)
!0 = !DIExpression() !0 = !DIExpression()
!1 = !DIExpression(DW_OP_deref) !1 = !DIExpression(DW_OP_deref)
!2 = !DIExpression(DW_OP_constu, 3, DW_OP_plus) !2 = !DIExpression(DW_OP_constu, 3, DW_OP_plus)

View File

@ -1,9 +1,8 @@
; RUN: not llvm-as -disable-output < %s 2>&1 | FileCheck -check-prefix VERIFY %s ; RUN: not llvm-as -disable-output < %s 2>&1 | FileCheck -check-prefix VERIFY %s
; RUN: llvm-as -disable-verify < %s | llvm-dis | FileCheck -check-prefix NOVERIFY %s ; RUN: llvm-as -disable-verify < %s | llvm-dis | FileCheck -check-prefix NOVERIFY %s
; NOVERIFY: !named = !{!0} ; NOVERIFY: !named = !{!DIExpression(0, 1, 9, 7, 2)}
!named = !{!0} !named = !{!0}
; NOVERIFY: !0 = !DIExpression(0, 1, 9, 7, 2)
; VERIFY: assembly parsed, but does not verify ; VERIFY: assembly parsed, but does not verify
!0 = !DIExpression(0, 1, 9, 7, 2) !0 = !DIExpression(0, 1, 9, 7, 2)

View File

@ -2,8 +2,7 @@
%class.A = type { i32, i32, i32, i32 } %class.A = type { i32, i32, i32, i32 }
define void @_Z3fooi(%class.A* sret %agg.result) #0 !dbg !3 { define void @_Z3fooi(%class.A* sret %agg.result) #0 !dbg !3 {
; CHECK: call void @llvm.dbg.declare({{.*}}, metadata ![[EXPR:[0-9]+]]), !dbg ; CHECK: call void @llvm.dbg.declare({{.*}}, metadata !DIExpression()), !dbg
; CHECK: ![[EXPR]] = !DIExpression()
call void @llvm.dbg.declare(metadata %class.A* %agg.result, metadata !13, metadata !16), !dbg !17 call void @llvm.dbg.declare(metadata %class.A* %agg.result, metadata !13, metadata !16), !dbg !17
ret void, !dbg !17 ret void, !dbg !17
} }

View File

@ -5,16 +5,14 @@
; BC: GLOBAL_DECL_ATTACHMENT ; BC: GLOBAL_DECL_ATTACHMENT
; CHECK: @g = common global i32 0, align 4, !dbg ![[G:[0-9]+]] ; CHECK: @g = common global i32 0, align 4, !dbg ![[G:[0-9]+]]
; CHECK: @h = common global i32 0, align 4, !dbg ![[H:[0-9]+]] ; CHECK: @h = common global i32 0, align 4, !dbg ![[H:[0-9]+]]
; CHECK: ![[G]] = {{.*}}!DIGlobalVariableExpression(var: ![[GVAR:[0-9]+]], expr: ![[GEXPR:[0-9]+]]) ; CHECK: ![[G]] = {{.*}}!DIGlobalVariableExpression(var: ![[GVAR:[0-9]+]], expr: !DIExpression(DW_OP_plus_uconst, 1))
; CHECK: ![[GVAR]] = distinct !DIGlobalVariable(name: "g", ; CHECK: ![[GVAR]] = distinct !DIGlobalVariable(name: "g",
; CHECK: DICompileUnit({{.*}}, imports: ![[IMPORTS:[0-9]+]] ; CHECK: DICompileUnit({{.*}}, imports: ![[IMPORTS:[0-9]+]]
; CHECK: !DIGlobalVariableExpression(var: ![[CVAR:[0-9]+]], expr: ![[CEXPR:[0-9]+]]) ; CHECK: !DIGlobalVariableExpression(var: ![[CVAR:[0-9]+]], expr: !DIExpression(DW_OP_constu, 23, DW_OP_stack_value))
; CHECK: ![[CVAR]] = distinct !DIGlobalVariable(name: "c", ; CHECK: ![[CVAR]] = distinct !DIGlobalVariable(name: "c",
; CHECK: ![[CEXPR]] = !DIExpression(DW_OP_constu, 23, DW_OP_stack_value)
; CHECK: ![[HVAR:[0-9]+]] = distinct !DIGlobalVariable(name: "h", ; CHECK: ![[HVAR:[0-9]+]] = distinct !DIGlobalVariable(name: "h",
; CHECK: ![[IMPORTS]] = !{![[CIMPORT:[0-9]+]]} ; CHECK: ![[IMPORTS]] = !{![[CIMPORT:[0-9]+]]}
; CHECK: ![[CIMPORT]] = !DIImportedEntity({{.*}}entity: ![[HVAR]] ; CHECK: ![[CIMPORT]] = !DIImportedEntity({{.*}}entity: ![[HVAR]]
; CHECK: ![[GEXPR]] = !DIExpression(DW_OP_plus_uconst, 1)
; CHECK: ![[H]] = {{.*}}!DIGlobalVariableExpression(var: ![[HVAR]]) ; CHECK: ![[H]] = {{.*}}!DIGlobalVariableExpression(var: ![[HVAR]])
@g = common global i32 0, align 4, !dbg !0 @g = common global i32 0, align 4, !dbg !0

View File

@ -9,9 +9,8 @@
!2 = !{} !2 = !{}
; CHECK: !3 = !{!4} ; CHECK: !3 = !{!4}
!3 = !{!4} !3 = !{!4}
; CHECK: !4 = {{.*}}!DIGlobalVariableExpression(var: !5, expr: !8) ; CHECK: !4 = {{.*}}!DIGlobalVariableExpression(var: !5, expr: !DIExpression(DW_OP_constu, 42, DW_OP_stack_value))
; CHECK: !5 = !DIGlobalVariable(name: "c", scope: !0, file: !1, line: 1, type: !6, isLocal: false, isDefinition: true) ; CHECK: !5 = !DIGlobalVariable(name: "c", scope: !0, file: !1, line: 1, type: !6, isLocal: false, isDefinition: true)
; CHECK: !8 = !DIExpression(DW_OP_constu, 42, DW_OP_stack_value)
!4 = !DIGlobalVariable(name: "c", scope: !0, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, variable: i32 42) !4 = !DIGlobalVariable(name: "c", scope: !0, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, variable: i32 42)
!5 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !6) !5 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !6)
!6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) !6 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)

View File

@ -6,7 +6,7 @@
define void @f() !dbg !3 { define void @f() !dbg !3 {
entry: entry:
; CHECK-NOT: call void @llvm.dbg.value ; CHECK-NOT: call void @llvm.dbg.value
; CHECK: call void @llvm.dbg.value(metadata i32 42, metadata !8, metadata !9), !dbg !10 ; CHECK: call void @llvm.dbg.value(metadata i32 42, metadata !8, metadata !DIExpression())
call void @llvm.dbg.value(metadata i32 42, i64 0, metadata !8, metadata !9), !dbg !10 call void @llvm.dbg.value(metadata i32 42, i64 0, metadata !8, metadata !9), !dbg !10
; CHECK-NOT: call void @llvm.dbg.value ; CHECK-NOT: call void @llvm.dbg.value
call void @llvm.dbg.value(metadata i32 0, i64 1, metadata !8, metadata !9), !dbg !10 call void @llvm.dbg.value(metadata i32 0, i64 1, metadata !8, metadata !9), !dbg !10

View File

@ -4,41 +4,41 @@
; CHECK-LABEL: name: debug_declare ; CHECK-LABEL: name: debug_declare
; CHECK: stack: ; CHECK: stack:
; CHECK: - { id: {{.*}}, name: in.addr, type: default, offset: 0, size: {{.*}}, alignment: {{.*}}, ; CHECK: - { id: {{.*}}, name: in.addr, type: default, offset: 0, size: {{.*}}, alignment: {{.*}},
; CHECK-NEXT: callee-saved-register: '', di-variable: '!11', di-expression: '!12', ; CHECK-NEXT: callee-saved-register: '', di-variable: '!11', di-expression: '!DIExpression()',
; CHECK: DBG_VALUE debug-use %0(s32), debug-use _, !11, !12, debug-location !13 ; CHECK: DBG_VALUE debug-use %0(s32), debug-use _, !11, !DIExpression(), debug-location !12
define void @debug_declare(i32 %in) #0 !dbg !7 { define void @debug_declare(i32 %in) #0 !dbg !7 {
entry: entry:
%in.addr = alloca i32, align 4 %in.addr = alloca i32, align 4
store i32 %in, i32* %in.addr, align 4 store i32 %in, i32* %in.addr, align 4
call void @llvm.dbg.declare(metadata i32* %in.addr, metadata !11, metadata !12), !dbg !13 call void @llvm.dbg.declare(metadata i32* %in.addr, metadata !11, metadata !DIExpression()), !dbg !12
call void @llvm.dbg.declare(metadata i32 %in, metadata !11, metadata !12), !dbg !13 call void @llvm.dbg.declare(metadata i32 %in, metadata !11, metadata !DIExpression()), !dbg !12
ret void, !dbg !13 ret void, !dbg !12
} }
; CHECK-LABEL: name: debug_declare_vla ; CHECK-LABEL: name: debug_declare_vla
; CHECK: DBG_VALUE debug-use %{{[0-9]+}}(p0), debug-use _, !15, !12, debug-location !16 ; CHECK: DBG_VALUE debug-use %{{[0-9]+}}(p0), debug-use _, !14, !DIExpression(), debug-location !15
define void @debug_declare_vla(i32 %in) #0 !dbg !14 { define void @debug_declare_vla(i32 %in) #0 !dbg !13 {
entry: entry:
%vla.addr = alloca i32, i32 %in %vla.addr = alloca i32, i32 %in
call void @llvm.dbg.declare(metadata i32* %vla.addr, metadata !15, metadata !12), !dbg !16 call void @llvm.dbg.declare(metadata i32* %vla.addr, metadata !14, metadata !DIExpression()), !dbg !15
ret void, !dbg !16 ret void, !dbg !15
} }
; CHECK-LABEL: name: debug_value ; CHECK-LABEL: name: debug_value
; CHECK: [[IN:%[0-9]+]](s32) = COPY %w0 ; CHECK: [[IN:%[0-9]+]](s32) = COPY %w0
define void @debug_value(i32 %in) #0 !dbg !17 { define void @debug_value(i32 %in) #0 !dbg !16 {
%addr = alloca i32 %addr = alloca i32
; CHECK: DBG_VALUE debug-use [[IN]](s32), debug-use _, !18, !12, debug-location !19 ; CHECK: DBG_VALUE debug-use [[IN]](s32), debug-use _, !17, !DIExpression(), debug-location !18
call void @llvm.dbg.value(metadata i32 %in, i64 0, metadata !18, metadata !12), !dbg !19 call void @llvm.dbg.value(metadata i32 %in, i64 0, metadata !17, metadata !DIExpression()), !dbg !18
store i32 %in, i32* %addr store i32 %in, i32* %addr
; CHECK: DBG_VALUE debug-use %1(p0), debug-use _, !18, !20, debug-location !19 ; CHECK: DBG_VALUE debug-use %1(p0), debug-use _, !17, !DIExpression(DW_OP_deref), debug-location !18
call void @llvm.dbg.value(metadata i32* %addr, i64 0, metadata !18, metadata !20), !dbg !19 call void @llvm.dbg.value(metadata i32* %addr, i64 0, metadata !17, metadata !DIExpression(DW_OP_deref)), !dbg !18
; CHECK: DBG_VALUE 123, 0, !18, !12, debug-location !19 ; CHECK: DBG_VALUE 123, 0, !17, !DIExpression(), debug-location !18
call void @llvm.dbg.value(metadata i32 123, i64 0, metadata !18, metadata !12), !dbg !19 call void @llvm.dbg.value(metadata i32 123, i64 0, metadata !17, metadata !DIExpression()), !dbg !18
; CHECK: DBG_VALUE float 1.000000e+00, 0, !18, !12, debug-location !19 ; CHECK: DBG_VALUE float 1.000000e+00, 0, !17, !DIExpression(), debug-location !18
call void @llvm.dbg.value(metadata float 1.000000e+00, i64 0, metadata !18, metadata !12), !dbg !19 call void @llvm.dbg.value(metadata float 1.000000e+00, i64 0, metadata !17, metadata !DIExpression()), !dbg !18
; CHECK: DBG_VALUE _, 0, !18, !12, debug-location !19 ; CHECK: DBG_VALUE _, 0, !17, !DIExpression(), debug-location !18
call void @llvm.dbg.value(metadata i32* null, i64 0, metadata !18, metadata !12), !dbg !19 call void @llvm.dbg.value(metadata i32* null, i64 0, metadata !17, metadata !DIExpression()), !dbg !18
ret void ret void
} }
@ -62,12 +62,10 @@ declare void @llvm.dbg.value(metadata, i64, metadata, metadata)
!9 = !{null, !10} !9 = !{null, !10}
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!11 = !DILocalVariable(name: "in", arg: 1, scope: !7, file: !1, line: 1, type: !10) !11 = !DILocalVariable(name: "in", arg: 1, scope: !7, file: !1, line: 1, type: !10)
!12 = !DIExpression() !12 = !DILocation(line: 1, column: 14, scope: !7)
!13 = !DILocation(line: 1, column: 14, scope: !7) !13 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
!14 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2) !14 = !DILocalVariable(name: "in", arg: 1, scope: !13, file: !1, line: 1, type: !10)
!15 = !DILocalVariable(name: "in", arg: 1, scope: !14, file: !1, line: 1, type: !10) !15 = !DILocation(line: 1, column: 14, scope: !13)
!16 = !DILocation(line: 1, column: 14, scope: !14) !16 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
!17 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2) !17 = !DILocalVariable(name: "in", arg: 1, scope: !16, file: !1, line: 1, type: !10)
!18 = !DILocalVariable(name: "in", arg: 1, scope: !17, file: !1, line: 1, type: !10) !18 = !DILocation(line: 1, column: 14, scope: !16)
!19 = !DILocation(line: 1, column: 14, scope: !17)
!20 = !DIExpression(DW_OP_deref)

View File

@ -5,7 +5,7 @@
define void @test_dbg_value() !dbg !5 { define void @test_dbg_value() !dbg !5 {
; Keep the dbg metadata live by referencing it in the IR. ; Keep the dbg metadata live by referencing it in the IR.
call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !7, metadata !9), !dbg !10 call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !7, metadata !DIExpression()), !dbg !9
ret void ret void
} }
@ -23,8 +23,7 @@
!6 = !DISubroutineType(types: !2) !6 = !DISubroutineType(types: !2)
!7 = !DILocalVariable(name: "in", arg: 1, scope: !5, file: !1, line: 1, type: !8) !7 = !DILocalVariable(name: "in", arg: 1, scope: !5, file: !1, line: 1, type: !8)
!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!9 = !DIExpression() !9 = !DILocation(line: 1, column: 1, scope: !5)
!10 = !DILocation(line: 1, column: 1, scope: !5)
... ...
--- ---
@ -37,9 +36,9 @@ body: |
bb.0: bb.0:
liveins: %w0 liveins: %w0
%0:_(s32) = COPY %w0 %0:_(s32) = COPY %w0
; CHECK: DBG_VALUE debug-use %0(s32), debug-use _, !7, !9, debug-location !10 ; CHECK: DBG_VALUE debug-use %0(s32), debug-use _, !7, !DIExpression(), debug-location !9
DBG_VALUE debug-use %0(s32), debug-use _, !7, !9, debug-location !10 DBG_VALUE debug-use %0(s32), debug-use _, !7, !DIExpression(), debug-location !9
; CHECK: DBG_VALUE _, 0, !7, !9, debug-location !10 ; CHECK: DBG_VALUE _, 0, !7, !DIExpression(), debug-location !9
DBG_VALUE _, 0, !7, !9, debug-location !10 DBG_VALUE _, 0, !7, !DIExpression(), debug-location !9
... ...

View File

@ -5,12 +5,12 @@
define void @test_dbg_value(i32 %a) !dbg !5 { define void @test_dbg_value(i32 %a) !dbg !5 {
%tmp0 = add i32 %a, %a %tmp0 = add i32 %a, %a
call void @llvm.dbg.value(metadata i32 %tmp0, i64 0, metadata !7, metadata !9), !dbg !10 call void @llvm.dbg.value(metadata i32 %tmp0, i64 0, metadata !7, metadata !DIExpression()), !dbg !9
ret void ret void
} }
define void @test_dbg_value_dead(i32 %a) !dbg !11 { define void @test_dbg_value_dead(i32 %a) !dbg !10 {
call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !12, metadata !9), !dbg !13 call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !11, metadata !DIExpression()), !dbg !12
ret void ret void
} }
@ -28,11 +28,10 @@
!6 = !DISubroutineType(types: !2) !6 = !DISubroutineType(types: !2)
!7 = !DILocalVariable(name: "in", arg: 1, scope: !5, file: !1, line: 1, type: !8) !7 = !DILocalVariable(name: "in", arg: 1, scope: !5, file: !1, line: 1, type: !8)
!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!9 = !DIExpression() !9 = !DILocation(line: 1, column: 1, scope: !5)
!10 = !DILocation(line: 1, column: 1, scope: !5) !10 = distinct !DISubprogram(name: "test_dbg_value", scope: !1, file: !1, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2)
!11 = distinct !DISubprogram(name: "test_dbg_value", scope: !1, file: !1, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, variables: !2) !11 = !DILocalVariable(name: "in", arg: 1, scope: !10, file: !1, line: 1, type: !8)
!12 = !DILocalVariable(name: "in", arg: 1, scope: !11, file: !1, line: 1, type: !8) !12 = !DILocation(line: 1, column: 1, scope: !10)
!13 = !DILocation(line: 1, column: 1, scope: !11)
... ...
--- ---
@ -50,9 +49,9 @@ body: |
; CHECK: %0 = COPY %w0 ; CHECK: %0 = COPY %w0
; CHECK-NEXT: %1 = ADDWrr %0, %0 ; CHECK-NEXT: %1 = ADDWrr %0, %0
; CHECK-NEXT: %w0 = COPY %1 ; CHECK-NEXT: %w0 = COPY %1
; CHECK-NEXT: DBG_VALUE debug-use %1, debug-use _, !7, !9, debug-location !10 ; CHECK-NEXT: DBG_VALUE debug-use %1, debug-use _, !7, !DIExpression(), debug-location !9
DBG_VALUE debug-use %1(s32), debug-use _, !7, !9, debug-location !10 DBG_VALUE debug-use %1(s32), debug-use _, !7, !DIExpression(), debug-location !9
... ...
--- ---
@ -66,7 +65,7 @@ body: |
%0:gpr(s32) = COPY %w0 %0:gpr(s32) = COPY %w0
; CHECK-NOT: COPY ; CHECK-NOT: COPY
; CHECK: DBG_VALUE debug-use _, debug-use _, !7, !9, debug-location !10 ; CHECK: DBG_VALUE debug-use _, debug-use _, !7, !DIExpression(), debug-location !9
DBG_VALUE debug-use %0(s32), debug-use _, !7, !9, debug-location !10 DBG_VALUE debug-use %0(s32), debug-use _, !7, !DIExpression(), debug-location !9
... ...

View File

@ -8,18 +8,18 @@
entry: entry:
%x.addr = alloca i32, align 4 %x.addr = alloca i32, align 4
store i32 %x, i32* %x.addr, align 4 store i32 %x, i32* %x.addr, align 4
call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !12, metadata !13), !dbg !14 call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !12, metadata !DIExpression()), !dbg !13
%0 = load i32, i32* %x.addr, align 4, !dbg !15 %0 = load i32, i32* %x.addr, align 4, !dbg !14
ret i32 %0, !dbg !15 ret i32 %0, !dbg !14
} }
define i32 @test_typed_immediates(i32 %x) #0 { define i32 @test_typed_immediates(i32 %x) #0 {
entry: entry:
%x.addr = alloca i32, align 4 %x.addr = alloca i32, align 4
store i32 %x, i32* %x.addr, align 4 store i32 %x, i32* %x.addr, align 4
call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !12, metadata !13), !dbg !14 call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !12, metadata !DIExpression()), !dbg !13
%0 = load i32, i32* %x.addr, align 4, !dbg !15 %0 = load i32, i32* %x.addr, align 4, !dbg !14
ret i32 %0, !dbg !15 ret i32 %0, !dbg !14
} }
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
@ -43,9 +43,8 @@
!10 = !{i32 2, !"Debug Info Version", i32 3} !10 = !{i32 2, !"Debug Info Version", i32 3}
!11 = !{!"clang version 3.7.0"} !11 = !{!"clang version 3.7.0"}
!12 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 4, type: !8) !12 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 4, type: !8)
!13 = !DIExpression() !13 = !DILocation(line: 4, scope: !4)
!14 = !DILocation(line: 4, scope: !4) !14 = !DILocation(line: 8, scope: !4)
!15 = !DILocation(line: 8, scope: !4)
... ...
--- ---
@ -60,14 +59,14 @@ stack:
body: | body: |
bb.0.entry: bb.0.entry:
liveins: %edi liveins: %edi
; CHECK: DBG_VALUE debug-use _, 0, !11, !12, debug-location !13 ; CHECK: DBG_VALUE debug-use _, 0, !11, !DIExpression(), debug-location !12
; CHECK: %eax = COPY %0, debug-location !14 ; CHECK: %eax = COPY %0, debug-location !13
; CHECK: RETQ %eax, debug-location !14 ; CHECK: RETQ %eax, debug-location !13
%0 = COPY %edi %0 = COPY %edi
DBG_VALUE debug-use _, 0, !12, !13, debug-location !14 DBG_VALUE debug-use _, 0, !12, !DIExpression(), debug-location !13
MOV32mr %stack.0.x.addr, 1, _, 0, _, %0 MOV32mr %stack.0.x.addr, 1, _, 0, _, %0
%eax = COPY %0, debug-location !15 %eax = COPY %0, debug-location !14
RETQ %eax, debug-location !15 RETQ %eax, debug-location !14
... ...
--- ---
name: test_typed_immediates name: test_typed_immediates
@ -83,12 +82,12 @@ body: |
liveins: %edi liveins: %edi
%0 = COPY %edi %0 = COPY %edi
; CHECK: DBG_VALUE _, i32 0, !11, !12 ; CHECK: DBG_VALUE _, i32 0, !DIExpression(), !12
; CHECK-NEXT: DBG_VALUE _, i64 -22, !11, !12 ; CHECK-NEXT: DBG_VALUE _, i64 -22, !DIExpression(), !12
; CHECK-NEXT: DBG_VALUE _, i128 123492148938512984928424384934328985928, !11, !12 ; CHECK-NEXT: DBG_VALUE _, i128 123492148938512984928424384934328985928, !DIExpression(), !12
DBG_VALUE _, i32 0, !12, !13 DBG_VALUE _, i32 0, !DIExpression(), !13
DBG_VALUE _, i64 -22, !12, !13 DBG_VALUE _, i64 -22, !DIExpression(), !13
DBG_VALUE _, i128 123492148938512984928424384934328985928, !12, !13 DBG_VALUE _, i128 123492148938512984928424384934328985928, !DIExpression(), !13
MOV32mr %stack.0.x.addr, 1, _, 0, _, %0 MOV32mr %stack.0.x.addr, 1, _, 0, _, %0
%eax = COPY %0 %eax = COPY %0
RETQ %eax RETQ %eax

View File

@ -8,9 +8,9 @@
entry: entry:
%x.addr = alloca i32, align 4 %x.addr = alloca i32, align 4
store i32 %x, i32* %x.addr, align 4 store i32 %x, i32* %x.addr, align 4
call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !12, metadata !13), !dbg !14 call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !12, metadata !DIExpression()), !dbg !13
%0 = load i32, i32* %x.addr, align 4, !dbg !15 %0 = load i32, i32* %x.addr, align 4, !dbg !14
ret i32 %0, !dbg !15 ret i32 %0, !dbg !14
} }
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
@ -34,9 +34,8 @@
!10 = !{i32 2, !"Debug Info Version", i32 3} !10 = !{i32 2, !"Debug Info Version", i32 3}
!11 = !{!"clang version 3.7.0"} !11 = !{!"clang version 3.7.0"}
!12 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 4, type: !8) !12 = !DILocalVariable(name: "x", arg: 1, scope: !4, file: !5, line: 4, type: !8)
!13 = !DIExpression() !13 = !DILocation(line: 4, scope: !4)
!14 = !DILocation(line: 4, scope: !4) !14 = !DILocation(line: 8, scope: !4)
!15 = !DILocation(line: 8, scope: !4)
... ...
--- ---
@ -52,9 +51,9 @@ body: |
bb.0.entry: bb.0.entry:
liveins: %edi liveins: %edi
; CHECK: %0 = COPY %edi ; CHECK: %0 = COPY %edi
; CHECK-NEXT: DBG_VALUE _, 0, !11, !12 ; CHECK-NEXT: DBG_VALUE _, 0, !11, !DIExpression()
%0 = COPY %edi %0 = COPY %edi
DBG_VALUE _, 0, !12, ! 13 DBG_VALUE _, 0, !12, !DIExpression()
MOV32mr %stack.0.x.addr, 1, _, 0, _, %0 MOV32mr %stack.0.x.addr, 1, _, 0, _, %0
%eax = COPY %0 %eax = COPY %0
RETQ %eax RETQ %eax

View File

@ -15,7 +15,7 @@
%1 = bitcast [256 x i8]* %y.i to i8* %1 = bitcast [256 x i8]* %y.i to i8*
call void @llvm.lifetime.end(i64 -1, i8* %1) #3 call void @llvm.lifetime.end(i64 -1, i8* %1) #3
call void @llvm.lifetime.start(i64 -1, i8* %0) #3 call void @llvm.lifetime.start(i64 -1, i8* %0) #3
call void @llvm.dbg.declare(metadata i8* %0, metadata !4, metadata !7) #3, !dbg !8 call void @llvm.dbg.declare(metadata i8* %0, metadata !4, metadata !DIExpression()) #3, !dbg !7
br label %for.body br label %for.body
} }
@ -35,14 +35,13 @@
!1 = !DIFile(filename: "t.c", directory: "") !1 = !DIFile(filename: "t.c", directory: "")
!2 = !{} !2 = !{}
!3 = !{i32 1, !"Debug Info Version", i32 3} !3 = !{i32 1, !"Debug Info Version", i32 3}
!4 = !DILocalVariable(name: "x", scope: !5, file: !1, line: 16, type: !9) !4 = !DILocalVariable(name: "x", scope: !5, file: !1, line: 16, type: !8)
!5 = distinct !DISubprogram(scope: null, isLocal: false, isDefinition: true, isOptimized: false, unit: !0) !5 = distinct !DISubprogram(scope: null, isLocal: false, isDefinition: true, isOptimized: false, unit: !0)
!6 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) !6 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
!7 = !DIExpression() !7 = !DILocation(line: 0, scope: !5)
!8 = !DILocation(line: 0, scope: !5) !8 = !DICompositeType(tag: DW_TAG_array_type, baseType: !6, size: 2048, align: 8, elements: !9)
!9 = !DICompositeType(tag: DW_TAG_array_type, baseType: !6, size: 2048, align: 8, elements: !10) !9 = !{!10}
!10 = !{!11} !10 = !DISubrange(count: 256)
!11 = !DISubrange(count: 256)
... ...
--- ---
name: foo name: foo
@ -52,17 +51,17 @@ frameInfo:
# CHECK-LABEL: foo # CHECK-LABEL: foo
# CHECK: stack: # CHECK: stack:
# CHECK: - { id: 0, name: y.i, type: default, offset: 0, size: 256, alignment: 16, # CHECK: - { id: 0, name: y.i, type: default, offset: 0, size: 256, alignment: 16,
# CHECK-NEXT: callee-saved-register: '', di-variable: '!4', di-expression: '!10', # CHECK-NEXT: callee-saved-register: '', di-variable: '!4', di-expression: '!DIExpression()',
# CHECK-NEXT: di-location: '!11' } # CHECK-NEXT: di-location: '!10' }
stack: stack:
- { id: 0, name: y.i, offset: 0, size: 256, alignment: 16, di-variable: '!4', - { id: 0, name: y.i, offset: 0, size: 256, alignment: 16, di-variable: '!4',
di-expression: '!7', di-location: '!8' } di-expression: '!DIExpression()', di-location: '!7' }
body: | body: |
bb.0.entry: bb.0.entry:
successors: %bb.1.for.body successors: %bb.1.for.body
bb.1.for.body: bb.1.for.body:
successors: %bb.1.for.body successors: %bb.1.for.body
DBG_VALUE %stack.0.y.i, 0, !4, !7, debug-location !8 DBG_VALUE %stack.0.y.i, 0, !4, !DIExpression(), debug-location !7
JMP_1 %bb.1.for.body JMP_1 %bb.1.for.body
... ...

View File

@ -14,22 +14,22 @@
@d = common local_unnamed_addr global i32 0, align 4 @d = common local_unnamed_addr global i32 0, align 4
@b = common local_unnamed_addr global i32 0, align 4 @b = common local_unnamed_addr global i32 0, align 4
define i32 @fn1() local_unnamed_addr !dbg !9 { define i32 @fn1() local_unnamed_addr !dbg !8 {
%1 = load %struct.A*, %struct.A** @c, align 8, !dbg !14 %1 = load %struct.A*, %struct.A** @c, align 8, !dbg !13
%2 = load i32, i32* @a, align 4, !dbg !14 %2 = load i32, i32* @a, align 4, !dbg !13
%3 = sext i32 %2 to i64, !dbg !14 %3 = sext i32 %2 to i64, !dbg !13
%4 = getelementptr inbounds %struct.A, %struct.A* %1, i64 %3, !dbg !14 %4 = getelementptr inbounds %struct.A, %struct.A* %1, i64 %3, !dbg !13
%5 = ptrtoint %struct.A* %4 to i64, !dbg !14 %5 = ptrtoint %struct.A* %4 to i64, !dbg !13
%6 = trunc i64 %5 to i32, !dbg !14 %6 = trunc i64 %5 to i32, !dbg !13
store i32 %6, i32* @d, align 4, !dbg !14 store i32 %6, i32* @d, align 4, !dbg !13
%7 = getelementptr inbounds %struct.A, %struct.A* %1, i64 %3, i32 2, !dbg !15 %7 = getelementptr inbounds %struct.A, %struct.A* %1, i64 %3, i32 2, !dbg !14
tail call void @llvm.dbg.value(metadata i32* %7, i64 0, metadata !12, metadata !16), !dbg !17 tail call void @llvm.dbg.value(metadata i32* %7, i64 0, metadata !11, metadata !DIExpression()), !dbg !15
br label %8, !dbg !18 br label %8, !dbg !16
; <label>:8: ; preds = %8, %0 ; <label>:8: ; preds = %8, %0
%9 = load i32, i32* %7, align 4, !dbg !19 %9 = load i32, i32* %7, align 4, !dbg !17
store i32 %9, i32* @d, align 4, !dbg !19 store i32 %9, i32* @d, align 4, !dbg !17
br label %8, !dbg !20 br label %8, !dbg !18
} }
; Function Attrs: nounwind readnone ; Function Attrs: nounwind readnone
@ -39,7 +39,6 @@
!llvm.dbg.cu = !{!0} !llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!5, !6, !7} !llvm.module.flags = !{!5, !6, !7}
!misc = !{!8}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, globals: !2) !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, globals: !2)
!1 = !DIFile(filename: "test.c", directory: "") !1 = !DIFile(filename: "test.c", directory: "")
@ -49,19 +48,17 @@
!5 = !{i32 2, !"Dwarf Version", i32 4} !5 = !{i32 2, !"Dwarf Version", i32 4}
!6 = !{i32 2, !"Debug Info Version", i32 3} !6 = !{i32 2, !"Debug Info Version", i32 3}
!7 = !{i32 1, !"PIC Level", i32 2} !7 = !{i32 1, !"PIC Level", i32 2}
!8 = !DIExpression(DW_OP_plus_uconst, 8, DW_OP_stack_value) !8 = distinct !DISubprogram(name: "fn1", scope: !1, file: !1, line: 7, type: !9, isLocal: false, isDefinition: true, scopeLine: 7, isOptimized: true, unit: !0, variables: !10)
!9 = distinct !DISubprogram(name: "fn1", scope: !1, file: !1, line: 7, type: !10, isLocal: false, isDefinition: true, scopeLine: 7, isOptimized: true, unit: !0, variables: !11) !9 = !DISubroutineType(types: !3)
!10 = !DISubroutineType(types: !3) !10 = !{!11}
!11 = !{!12} !11 = !DILocalVariable(name: "e", scope: !8, file: !1, line: 8, type: !12)
!12 = !DILocalVariable(name: "e", scope: !9, file: !1, line: 8, type: !13) !12 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64)
!13 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64) !13 = !DILocation(line: 9, scope: !8)
!14 = !DILocation(line: 9, scope: !9) !14 = !DILocation(line: 10, scope: !8)
!15 = !DILocation(line: 10, scope: !9) !15 = !DILocation(line: 8, scope: !8)
!16 = !DIExpression() !16 = !DILocation(line: 11, scope: !8)
!17 = !DILocation(line: 8, scope: !9) !17 = !DILocation(line: 13, scope: !8)
!18 = !DILocation(line: 11, scope: !9) !18 = !DILocation(line: 14, scope: !8)
!19 = !DILocation(line: 13, scope: !9)
!20 = !DILocation(line: 14, scope: !9)
... ...
--- ---
@ -98,28 +95,28 @@ body: |
bb.0 (%ir-block.0): bb.0 (%ir-block.0):
successors: %bb.1(0x80000000) successors: %bb.1(0x80000000)
; CHECK: %3 = LEA64r %2, 2, %2, 0, _, debug-location !14 ; CHECK: %3 = LEA64r %2, 2, %2, 0, _, debug-location !13
; CHECK-NEXT: %4 = LEA64r %1, 4, %3, 0, _, debug-location !14 ; CHECK-NEXT: %4 = LEA64r %1, 4, %3, 0, _, debug-location !13
; CHECK-NOT: %0 = LEA64r %1, 4, %3, 8, _, debug-location !15 ; CHECK-NOT: %0 = LEA64r %1, 4, %3, 8, _, debug-location !14
; CHECK: DBG_VALUE debug-use %4, debug-use _, !12, !8, debug-location !17 ; CHECK: DBG_VALUE debug-use %4, debug-use _, !11, !DIExpression(DW_OP_plus_uconst, 8, DW_OP_stack_value), debug-location !15
%1 = MOV64rm %rip, 1, _, @c, _, debug-location !14 :: (dereferenceable load 8 from @c) %1 = MOV64rm %rip, 1, _, @c, _, debug-location !13 :: (dereferenceable load 8 from @c)
%2 = MOVSX64rm32 %rip, 1, _, @a, _, debug-location !14 :: (dereferenceable load 4 from @a) %2 = MOVSX64rm32 %rip, 1, _, @a, _, debug-location !13 :: (dereferenceable load 4 from @a)
%3 = LEA64r %2, 2, %2, 0, _, debug-location !14 %3 = LEA64r %2, 2, %2, 0, _, debug-location !13
%4 = LEA64r %1, 4, %3, 0, _, debug-location !14 %4 = LEA64r %1, 4, %3, 0, _, debug-location !13
%5 = COPY %4.sub_32bit, debug-location !14 %5 = COPY %4.sub_32bit, debug-location !13
MOV32mr %rip, 1, _, @d, _, killed %5, debug-location !14 :: (store 4 into @d) MOV32mr %rip, 1, _, @d, _, killed %5, debug-location !13 :: (store 4 into @d)
%0 = LEA64r %1, 4, %3, 8, _, debug-location !15 %0 = LEA64r %1, 4, %3, 8, _, debug-location !14
DBG_VALUE debug-use %0, debug-use _, !12, !16, debug-location !17 DBG_VALUE debug-use %0, debug-use _, !11, !DIExpression(), debug-location !15
; CHECK-LABEL: bb.1 (%ir-block.8): ; CHECK-LABEL: bb.1 (%ir-block.8):
; CHECK: %6 = MOV32rm %4, 1, _, 8, _, debug-location !19 :: (load 4 from %ir.7) ; CHECK: %6 = MOV32rm %4, 1, _, 8, _, debug-location !17 :: (load 4 from %ir.7)
bb.1 (%ir-block.8): bb.1 (%ir-block.8):
successors: %bb.1(0x80000000) successors: %bb.1(0x80000000)
%6 = MOV32rm %0, 1, _, 0, _, debug-location !19 :: (load 4 from %ir.7) %6 = MOV32rm %0, 1, _, 0, _, debug-location !17 :: (load 4 from %ir.7)
MOV32mr %rip, 1, _, @d, _, killed %6, debug-location !19 :: (store 4 into @d) MOV32mr %rip, 1, _, @d, _, killed %6, debug-location !17 :: (store 4 into @d)
JMP_1 %bb.1, debug-location !20 JMP_1 %bb.1, debug-location !18
... ...

View File

@ -227,6 +227,11 @@
!47 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed) !47 = !DIBasicType(name: "long int", size: 64, encoding: DW_ATE_signed)
!48 = !DILocation(line: 10, column: 8, scope: !40, inlinedAt: !45) !48 = !DILocation(line: 10, column: 8, scope: !40, inlinedAt: !45)
# CHECK: ![[I_VAR:[0-9]+]] = !DILocalVariable(name: "i", {{.*}}line: 9, {{.*}})
# CHECK: ![[I_LOC:[0-9]+]] = !DILocation(line: 9, column: 37, {{.*}})
# CHECK: ![[J_VAR:[0-9]+]] = !DILocalVariable(name: "j", {{.*}}line: 10, {{.*}})
# CHECK: ![[J_LOC:[0-9]+]] = !DILocation(line: 10, column: 8, {{.*}})
... ...
--- ---
name: _ZN1sC2Ei name: _ZN1sC2Ei
@ -246,8 +251,8 @@ body: |
liveins: %esi, %rdi, %r14, %rbx, %rbp liveins: %esi, %rdi, %r14, %rbx, %rbp
; CHECK: [[REGISTER:%r[a-z0-9]+]] = LEA64r {{%r[a-z0-9]+}}, 1, _, -20, _ ; CHECK: [[REGISTER:%r[a-z0-9]+]] = LEA64r {{%r[a-z0-9]+}}, 1, _, -20, _
; CHECK-NEXT: DBG_VALUE debug-use [[REGISTER]], debug-use _, !46, !17, debug-location !48 ; CHECK-NEXT: DBG_VALUE debug-use [[REGISTER]], debug-use _, ![[J_VAR]], !DIExpression(), debug-location ![[J_LOC]]
; CHECK-NEXT: DBG_VALUE debug-use [[REGISTER]], debug-use _, !39, !17, debug-location !44 ; CHECK-NEXT: DBG_VALUE debug-use [[REGISTER]], debug-use _, ![[I_VAR]], !DIExpression(), debug-location ![[I_LOC]]
frame-setup PUSH64r killed %rbp, implicit-def %rsp, implicit %rsp frame-setup PUSH64r killed %rbp, implicit-def %rsp, implicit %rsp
CFI_INSTRUCTION def_cfa_offset 16 CFI_INSTRUCTION def_cfa_offset 16

View File

@ -20,14 +20,14 @@ entry:
; no native double data type available. ; no native double data type available.
; Test that debug info for both values survives: ; Test that debug info for both values survives:
; CHECK: call void @llvm.dbg.value(metadata i64 0, ; CHECK: call void @llvm.dbg.value(metadata i64 0,
; CHECK-SAME: metadata ![[C:.*]], metadata ![[REAL:.*]]) ; CHECK-SAME: metadata ![[C:[^,]*]],
; CHECK-SAME: metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64))
store double 0.000000e+00, double* %c.imagp, align 8, !dbg !17 store double 0.000000e+00, double* %c.imagp, align 8, !dbg !17
; CHECK: call void @llvm.dbg.value(metadata i64 0, ; CHECK: call void @llvm.dbg.value(metadata i64 0,
; CHECK-SAME: metadata ![[C]], metadata ![[IMG:.*]]) ; CHECK-SAME: metadata ![[C]],
; CHECK-SAME: metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64))
ret void, !dbg !18 ret void, !dbg !18
} }
; CHECK: ![[REAL]] = !DIExpression(DW_OP_LLVM_fragment, 0, 64)
; CHECK: ![[IMG]] = !DIExpression(DW_OP_LLVM_fragment, 64, 64)
; Function Attrs: nounwind readnone ; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1

View File

@ -24,11 +24,9 @@ target triple = "x86_64-apple-macosx10.12.0"
; CHECK: @array.0.0 = internal unnamed_addr global i32 0, align 16, !dbg ![[EL0:.*]] ; CHECK: @array.0.0 = internal unnamed_addr global i32 0, align 16, !dbg ![[EL0:.*]]
; CHECK: @array.1.0 = internal unnamed_addr global i32 0, align 8, !dbg ![[EL1:.*]] ; CHECK: @array.1.0 = internal unnamed_addr global i32 0, align 8, !dbg ![[EL1:.*]]
; ;
; CHECK: ![[EL0]] = !DIGlobalVariableExpression(var: ![[VAR:.*]], expr: ![[EX1:.*]]) ; CHECK: ![[EL0]] = !DIGlobalVariableExpression(var: ![[VAR:.*]], expr: !DIExpression(DW_OP_LLVM_fragment, 0, 32))
; CHECK: ![[VAR]] = distinct !DIGlobalVariable(name: "array" ; CHECK: ![[VAR]] = distinct !DIGlobalVariable(name: "array"
; CHECK: ![[EX1]] = !DIExpression(DW_OP_LLVM_fragment, 0, 32) ; CHECK: ![[EL1]] = !DIGlobalVariableExpression(var: ![[VAR]], expr: !DIExpression(DW_OP_LLVM_fragment, 64, 32))
; CHECK: ![[EL1]] = !DIGlobalVariableExpression(var: ![[VAR]], expr: ![[EX2:.*]])
; CHECK: ![[EX2]] = !DIExpression(DW_OP_LLVM_fragment, 64, 32)
; Function Attrs: nounwind optsize ssp uwtable ; Function Attrs: nounwind optsize ssp uwtable

View File

@ -22,11 +22,9 @@ target triple = "x86_64-apple-macosx10.12.0"
; CHECK: @static_struct.0 = internal unnamed_addr global i32 0, align 8, !dbg ![[EL0:.*]] ; CHECK: @static_struct.0 = internal unnamed_addr global i32 0, align 8, !dbg ![[EL0:.*]]
; CHECK: @static_struct.1 = internal unnamed_addr global i64 0, align 8, !dbg ![[EL1:.*]] ; CHECK: @static_struct.1 = internal unnamed_addr global i64 0, align 8, !dbg ![[EL1:.*]]
; CHECK: ![[EL0]] = !DIGlobalVariableExpression(var: ![[VAR:.*]], expr: ![[EX1:.*]]) ; CHECK: ![[EL0]] = !DIGlobalVariableExpression(var: ![[VAR:.*]], expr: !DIExpression(DW_OP_LLVM_fragment, 0, 32))
; CHECK: ![[VAR]] = distinct !DIGlobalVariable(name: "static_struct" ; CHECK: ![[VAR]] = distinct !DIGlobalVariable(name: "static_struct"
; CHECK: ![[EX1]] = !DIExpression(DW_OP_LLVM_fragment, 0, 32) ; CHECK: ![[EL1]] = !DIGlobalVariableExpression(var: ![[VAR]], expr: !DIExpression(DW_OP_LLVM_fragment, 32, 64))
; CHECK: ![[EL1]] = !DIGlobalVariableExpression(var: ![[VAR]], expr: ![[EX2:.*]])
; CHECK: ![[EX2]] = !DIExpression(DW_OP_LLVM_fragment, 32, 64)
@static_struct = internal global %struct.mystruct zeroinitializer, align 8, !dbg !0 @static_struct = internal global %struct.mystruct zeroinitializer, align 8, !dbg !0

View File

@ -24,12 +24,16 @@
# with clang -g -O1 -c -emit-llvm LiveDebugValues-3preds.c -S -o live-debug-values-3preds.ll # with clang -g -O1 -c -emit-llvm LiveDebugValues-3preds.c -S -o live-debug-values-3preds.ll
# then llc -stop-after stackmap-liveness live-debug-values-3preds.ll -o /dev/null > live-debug-values-3preds.mir # then llc -stop-after stackmap-liveness live-debug-values-3preds.ll -o /dev/null > live-debug-values-3preds.mir
# CHECK: ![[X_VAR:[0-9]+]] = !DILocalVariable(name: "x", {{.*}})
# CHECK: ![[Y_VAR:[0-9]+]] = !DILocalVariable(name: "y", {{.*}})
# CHECK: ![[Z_VAR:[0-9]+]] = !DILocalVariable(name: "z", {{.*}})
# DBG_VALUE for variables "x", "y" and "z" are extended into BB#9 from its # DBG_VALUE for variables "x", "y" and "z" are extended into BB#9 from its
# predecessors BB#0, BB#2 and BB#8. # predecessors BB#0, BB#2 and BB#8.
# CHECK: bb.9.for.end: # CHECK: bb.9.for.end:
# CHECK-DAG: DBG_VALUE debug-use %edi, debug-use _, !11, !16, debug-location !17 # CHECK-DAG: DBG_VALUE debug-use %edi, debug-use _, ![[X_VAR]], !DIExpression(), debug-location !{{[0-9]+}}
# CHECK-DAG: DBG_VALUE debug-use %edx, debug-use _, !13, !16, debug-location !20 # CHECK-DAG: DBG_VALUE debug-use %esi, debug-use _, ![[Y_VAR]], !DIExpression(), debug-location !{{[0-9]+}}
# CHECK-DAG: DBG_VALUE debug-use %esi, debug-use _, !12, !16, debug-location !18 # CHECK-DAG: DBG_VALUE debug-use %edx, debug-use _, ![[Z_VAR]], !DIExpression(), debug-location !{{[0-9]+}}
# CHECK: RET # CHECK: RET
--- | --- |

View File

@ -47,40 +47,41 @@
# llc -stop-after=funclet-layout < spill1.ll > spill1.mir # llc -stop-after=funclet-layout < spill1.ll > spill1.mir
# #
# Make sure that we generated DBG_VALUE instructions for the spills # Make sure that we generated DBG_VALUE instructions for the spills
# GENERATE: ![[MINUS48:.*]] = !DIExpression(DW_OP_constu, 48, DW_OP_minus) # GENERATE: ![[INT0:[0-9]+]] = !DILocalVariable(name: "int0",{{.*}})
# GENERATE: ![[MINUS52:.*]] = !DIExpression(DW_OP_constu, 52, DW_OP_minus) # GENERATE: ![[INTB:[0-9]+]] = !DILocalVariable(name: "intb",{{.*}})
# GENERATE: ![[MINUS56:.*]] = !DIExpression(DW_OP_constu, 56, DW_OP_minus) # GENERATE: ![[INTD:[0-9]+]] = !DILocalVariable(name: "intd",{{.*}})
#
# GENERATE: bb.1.if.end: # GENERATE: bb.1.if.end:
# GENERATE: MOV32mr %rbp, 1, _, -48, _, killed %edx :: (store 4 into %stack.5) # GENERATE: MOV32mr %rbp, 1, _, -48, _, killed %edx :: (store 4 into %stack.5)
# GENERATE-NEXT: DBG_VALUE debug-use %rbp, 0, !29, ![[MINUS48]] # GENERATE-NEXT: DBG_VALUE debug-use %rbp, 0, ![[INT0]], !DIExpression(DW_OP_constu, 48, DW_OP_minus)
# GENERATE: MOV32mr %rbp, 1, _, -52, _, killed %r8d :: (store 4 into %stack.4) # GENERATE: MOV32mr %rbp, 1, _, -52, _, killed %r8d :: (store 4 into %stack.4)
# GENERATE-NEXT: DBG_VALUE debug-use %rbp, 0, !35, ![[MINUS52]] # GENERATE-NEXT: DBG_VALUE debug-use %rbp, 0, ![[INTB]], !DIExpression(DW_OP_constu, 52, DW_OP_minus)
# GENERATE: MOV32mr %rbp, 1, _, -56, _, killed %esi :: (store 4 into %stack.3) # GENERATE: MOV32mr %rbp, 1, _, -56, _, killed %esi :: (store 4 into %stack.3)
# GENERATE-NEXT: DBG_VALUE debug-use %rbp, 0, !37, ![[MINUS56]] # GENERATE-NEXT: DBG_VALUE debug-use %rbp, 0, ![[INTD]], !DIExpression(DW_OP_constu, 56, DW_OP_minus)
# #
# Check that the spill locations that are valid at the end of bb.1.if.end are # Check that the spill locations that are valid at the end of bb.1.if.end are
# propagated to subsequent BBs. # propagated to subsequent BBs.
# #
# GENERATE: bb.2.if.then4: # GENERATE: bb.2.if.then4:
# GENERATE-NOT: bb.3: # GENERATE-NOT: bb.3:
# GENERATE-DAG: DBG_VALUE debug-use %rbp, 0, !37, ![[MINUS56]] # GENERATE-DAG: DBG_VALUE debug-use %rbp, 0, ![[INTD]], !DIExpression(DW_OP_constu, 56, DW_OP_minus)
# GENERATE-DAG: DBG_VALUE debug-use %rbp, 0, !35, ![[MINUS52]] # GENERATE-DAG: DBG_VALUE debug-use %rbp, 0, ![[INTB]], !DIExpression(DW_OP_constu, 52, DW_OP_minus)
# #
# GENERATE: bb.3: # GENERATE: bb.3:
# GENERATE-NOT: bb.4.if.end13: # GENERATE-NOT: bb.4.if.end13:
# GENERATE-DAG: DBG_VALUE debug-use %rbp, 0, !37, ![[MINUS56]] # GENERATE-DAG: DBG_VALUE debug-use %rbp, 0, ![[INTD]], !DIExpression(DW_OP_constu, 56, DW_OP_minus)
# GENERATE-DAG: DBG_VALUE debug-use %rbp, 0, !35, ![[MINUS52]] # GENERATE-DAG: DBG_VALUE debug-use %rbp, 0, ![[INTB]], !DIExpression(DW_OP_constu, 52, DW_OP_minus)
# #
# GENERATE: bb.4.if.end13: # GENERATE: bb.4.if.end13:
# GENERATE-NOT: bb.5.cleanup: # GENERATE-NOT: bb.5.cleanup:
# GENERATE-DAG: DBG_VALUE debug-use %rbp, 0, !37, ![[MINUS56]] # GENERATE-DAG: DBG_VALUE debug-use %rbp, 0, ![[INTD]], !DIExpression(DW_OP_constu, 56, DW_OP_minus)
# GENERATE-DAG: DBG_VALUE debug-use %rbp, 0, !35, ![[MINUS52]] # GENERATE-DAG: DBG_VALUE debug-use %rbp, 0, ![[INTB]], !DIExpression(DW_OP_constu, 52, DW_OP_minus)
# #
# Check that the spill location rbp-48 (the variable int0) is not propagated # Check that the spill location rbp-48 (the variable int0) is not propagated
# because int0 is redefined within the same basic block. # because int0 is redefined within the same basic block.
# #
# TERMINATE: bb.2.if.then4: # TERMINATE: bb.2.if.then4:
# TERMINATE-NOT: DBG_VALUE debug-use %rbp, -48, !26, !38 # TERMINATE-NOT: DBG_VALUE debug-use %rbp, -48,
--- | --- |
; ModuleID = '<stdin>' ; ModuleID = '<stdin>'
source_filename = "spill1.c" source_filename = "spill1.c"

View File

@ -32,8 +32,10 @@
# DBG_VALUE for variable "n" is extended into BB#5 from its predecessors BB#3 # DBG_VALUE for variable "n" is extended into BB#5 from its predecessors BB#3
# and BB#4. # and BB#4.
# CHECK: ![[N_VAR:[0-9]+]] = !DILocalVariable(name: "n",{{.*}})
#
# CHECK: bb.5.if.end.7: # CHECK: bb.5.if.end.7:
# CHECK: DBG_VALUE debug-use %ebx, debug-use _, !19, !20, debug-location !33 # CHECK: DBG_VALUE debug-use %ebx, debug-use _, ![[N_VAR]], !DIExpression(), debug-location !{{[0-9]+}}
--- | --- |

View File

@ -13,14 +13,25 @@
; This test verifies that LiveDebugValues doesn't propagate DBG_VALUEs into ; This test verifies that LiveDebugValues doesn't propagate DBG_VALUEs into
; basic blocks that are beyond the scope of the source variable. ; basic blocks that are beyond the scope of the source variable.
; ;
; CHECK: ![[F_SP:[0-9]+]] = distinct !DISubprogram(name: "f", {{.*}})
; CHECK: ![[A_VAR:[0-9]+]] = !DILocalVariable(name: "a",{{.*}})
; CHECK: ![[I_VAR:[0-9]+]] = !DILocalVariable(name: "i",{{.*}})
; CHECK: ![[I_LOC:[0-9]+]] = !DILocation(line: 4, column: 14, scope: !{{[0-9]+}})
; CHECK: ![[INLCS1:[0-9]+]] = !DILocation(line: 3, column: 41, scope: ![[F_SP]], inlinedAt: ![[CS1:[0-9]+]])
; CHECK: ![[CS1]] = distinct !DILocation(line: 5, column: 3, scope: !{{[0-9]+}})
; CHECK: ![[INLCS2:[0-9]+]] = !DILocation(line: 3, column: 41, scope: ![[F_SP]], inlinedAt: ![[CS2:[0-9]+]])
; CHECK: ![[CS2]] = distinct !DILocation(line: 7, column: 5, scope: !{{[0-9]+}})
; CHECK: ![[INLCS3:[0-9]+]] = !DILocation(line: 3, column: 41, scope: ![[F_SP]], inlinedAt: ![[CS3:[0-9]+]])
; CHECK: ![[CS3]] = distinct !DILocation(line: 8, column: 3, scope: !{{[0-9]+}})
;
; CHECK: bb.1.if.then: ; CHECK: bb.1.if.then:
; CHECK: DBG_VALUE debug-use %ebx, debug-use _, !19, !13, debug-location !20 ; CHECK: DBG_VALUE debug-use %ebx, debug-use _, ![[I_VAR]], !DIExpression(), debug-location ![[I_LOC]]
; CHECK-NOT: DBG_VALUE debug-use %ebx, debug-use _, !12, !13, debug-location !21 ; CHECK-NOT: DBG_VALUE debug-use %ebx, debug-use _, ![[A_VAR]], !DIExpression(), debug-location
; CHECK: DBG_VALUE debug-use %ebx, debug-use _, !12, !13, debug-location !27 ; CHECK: DBG_VALUE debug-use %ebx, debug-use _, ![[A_VAR]], !DIExpression(), debug-location ![[INLCS2]]
; CHECK: bb.2.if.end: ; CHECK: bb.2.if.end:
; CHECK: DBG_VALUE debug-use %ebx, debug-use _, !19, !13, debug-location !20 ; CHECK: DBG_VALUE debug-use %ebx, debug-use _, ![[I_VAR]], !DIExpression(), debug-location ![[I_LOC]]
; CHECK-NOT: DBG_VALUE debug-use %ebx, debug-use _, !12, !13, debug-location !21 ; CHECK-NOT: DBG_VALUE debug-use %ebx, debug-use _, ![[A_VAR]], !DIExpression(), debug-location
; CHECK: DBG_VALUE debug-use %ebx, debug-use _, !12, !13, debug-location !31 ; CHECK: DBG_VALUE debug-use %ebx, debug-use _, ![[A_VAR]], !DIExpression(), debug-location ![[INLCS3]]
; ;
; ModuleID = 'livedebugvalues-limit.ll' ; ModuleID = 'livedebugvalues-limit.ll'
source_filename = "livedebugvalues-limit.c" source_filename = "livedebugvalues-limit.c"

View File

@ -13,14 +13,10 @@
; return 0; ; return 0;
; } ; }
; ;
; CHECK: ![[MDN1:[0-9]+]] = !DIExpression(DW_OP_LLVM_fragment, 32, 16) ; CHECK-DAG: DBG_VALUE debug-use %r{{[0-9]+}}, debug-use _, !{{[0-9]+}}, !DIExpression(DW_OP_LLVM_fragment, 32, 16), debug-location !{{[0-9]+}}
; CHECK: ![[MDN2:[0-9]+]] = !DIExpression(DW_OP_LLVM_fragment, 48, 16) ; CHECK-DAG: DBG_VALUE debug-use %r{{[0-9]+}}, debug-use _, !{{[0-9]+}}, !DIExpression(DW_OP_LLVM_fragment, 48, 16), debug-location !{{[0-9]+}}
; CHECK: ![[MDN3:[0-9]+]] = !DIExpression(DW_OP_LLVM_fragment, 0, 16) ; CHECK-DAG: DBG_VALUE debug-use %r{{[0-9]+}}, debug-use _, !{{[0-9]+}}, !DIExpression(DW_OP_LLVM_fragment, 0, 16), debug-location !{{[0-9]+}}
; CHECK: ![[MDN4:[0-9]+]] = !DIExpression(DW_OP_LLVM_fragment, 16, 16) ; CHECK-DAG: DBG_VALUE debug-use %r{{[0-9]+}}, debug-use _, !{{[0-9]+}}, !DIExpression(DW_OP_LLVM_fragment, 16, 16), debug-location !{{[0-9]+}}
; CHECK-DAG: DBG_VALUE debug-use %r{{[0-9]+}}, debug-use _, !{{[0-9]+}}, ![[MDN1]], debug-location !{{[0-9]+}}
; CHECK-DAG: DBG_VALUE debug-use %r{{[0-9]+}}, debug-use _, !{{[0-9]+}}, ![[MDN2]], debug-location !{{[0-9]+}}
; CHECK-DAG: DBG_VALUE debug-use %r{{[0-9]+}}, debug-use _, !{{[0-9]+}}, ![[MDN3]], debug-location !{{[0-9]+}}
; CHECK-DAG: DBG_VALUE debug-use %r{{[0-9]+}}, debug-use _, !{{[0-9]+}}, ![[MDN4]], debug-location !{{[0-9]+}}
; ModuleID = 'sdagsplit-1.c' ; ModuleID = 'sdagsplit-1.c'
target datalayout = "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16" target datalayout = "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16"

View File

@ -16,9 +16,8 @@
; Test that we correctly lower dbg.declares for arrays. ; Test that we correctly lower dbg.declares for arrays.
; ;
; CHECK: define i32 @main ; CHECK: define i32 @main
; CHECK: call void @llvm.dbg.value(metadata i32 42, metadata ![[ARRAY:[0-9]+]], metadata ![[EXPR:[0-9]+]]) ; CHECK: call void @llvm.dbg.value(metadata i32 42, metadata ![[ARRAY:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32))
; CHECK: ![[ARRAY]] = !DILocalVariable(name: "array",{{.*}} line: 6 ; CHECK: ![[ARRAY]] = !DILocalVariable(name: "array",{{.*}} line: 6
; CHECK: ![[EXPR]] = !DIExpression(DW_OP_LLVM_fragment, 0, 32)
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.9.0" target triple = "x86_64-apple-macosx10.9.0"

View File

@ -9,11 +9,10 @@
; ++x; ; ++x;
; return x; // check that x is not a constant here. ; return x; // check that x is not a constant here.
; } ; }
; CHECK: ![[EXPR:.*]] = !DIExpression(DW_OP_plus_uconst, 4, DW_OP_deref)
; CHECK: ![[X:.*]] = !DILocalVariable(name: "x", ; CHECK: ![[X:.*]] = !DILocalVariable(name: "x",
; CHECK: bb.0.entry: ; CHECK: bb.0.entry:
; CHECK: DBG_VALUE 23, 0, ![[X]], ; CHECK: DBG_VALUE 23, 0, ![[X]],
; CHECK: DBG_VALUE %rsp, 0, ![[X]], ![[EXPR]], ; CHECK: DBG_VALUE %rsp, 0, ![[X]], !DIExpression(DW_OP_plus_uconst, 4, DW_OP_deref),
; CHECK: bb.1.if.then: ; CHECK: bb.1.if.then:
; CHECK: DBG_VALUE 43, 0, ![[X]], ; CHECK: DBG_VALUE 43, 0, ![[X]],
; CHECK: bb.2.if.end: ; CHECK: bb.2.if.end:

View File

@ -14,8 +14,7 @@
; } ; }
; CHECK: ![[ZZZ:.*]] = !DILocalVariable(name: "zzz", ; CHECK: ![[ZZZ:.*]] = !DILocalVariable(name: "zzz",
; CHECK: ![[ZZZ_EXPR:.*]] = !DIExpression(DW_OP_deref, DW_OP_constu, 400, DW_OP_minus) ; CHECK: DBG_VALUE {{.*}} ![[ZZZ]], !DIExpression(DW_OP_deref, DW_OP_constu, 400, DW_OP_minus)
; CHECK: DBG_VALUE {{.*}} ![[ZZZ]], ![[ZZZ_EXPR]]
%struct.S = type { [100 x i32] } %struct.S = type { [100 x i32] }

View File

@ -13,10 +13,8 @@
; return 0; ; return 0;
; } ; }
; ;
; CHECK: ![[MDN1:[0-9]+]] = !DIExpression(DW_OP_LLVM_fragment, 0, 32) ; CHECK-DAG: DBG_VALUE debug-use %{{[a-z]+}}, debug-use _, !{{[0-9]+}}, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !{{[0-9]+}}
; CHECK: ![[MDN2:[0-9]+]] = !DIExpression(DW_OP_LLVM_fragment, 32, 32) ; CHECK-DAG: DBG_VALUE debug-use %{{[a-z]+}}, debug-use _, !{{[0-9]+}}, !DIExpression(DW_OP_LLVM_fragment, 32, 32), debug-location !{{[0-9]+}}
; CHECK-DAG: DBG_VALUE debug-use %{{[a-z]+}}, debug-use _, !{{[0-9]+}}, ![[MDN1]], debug-location !{{[0-9]+}}
; CHECK-DAG: DBG_VALUE debug-use %{{[a-z]+}}, debug-use _, !{{[0-9]+}}, ![[MDN2]], debug-location !{{[0-9]+}}
; ModuleID = 'sdagsplit-1.c' ; ModuleID = 'sdagsplit-1.c'
target datalayout = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128" target datalayout = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"

View File

@ -21,13 +21,11 @@
; Verify that SROA creates a variable piece when splitting i1. ; Verify that SROA creates a variable piece when splitting i1.
; CHECK: %[[I1:.*]] = alloca [12 x i8], align 4 ; CHECK: %[[I1:.*]] = alloca [12 x i8], align 4
; CHECK: call void @llvm.dbg.declare(metadata [12 x i8]* %[[I1]], metadata ![[VAR:[0-9]+]], metadata ![[PIECE1:[0-9]+]]) ; CHECK: call void @llvm.dbg.declare(metadata [12 x i8]* %[[I1]], metadata ![[VAR:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 32, 96))
; CHECK: call void @llvm.dbg.value(metadata i32 %[[A:.*]], metadata ![[VAR]], metadata ![[PIECE2:[0-9]+]]) ; CHECK: call void @llvm.dbg.value(metadata i32 %[[A:.*]], metadata ![[VAR]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32))
; CHECK: ret i32 %[[A]] ; CHECK: ret i32 %[[A]]
; Read Var and Piece: ; Read Var and Piece:
; CHECK: ![[VAR]] = !DILocalVariable(name: "i1",{{.*}} line: 11, ; CHECK: ![[VAR]] = !DILocalVariable(name: "i1",{{.*}} line: 11,
; CHECK: ![[PIECE1]] = !DIExpression(DW_OP_LLVM_fragment, 32, 96)
; CHECK: ![[PIECE2]] = !DIExpression(DW_OP_LLVM_fragment, 0, 32)
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-apple-macosx10.9.0" target triple = "x86_64-apple-macosx10.9.0"

View File

@ -20,14 +20,11 @@
; ;
; Verify that SROA creates a variable piece when splitting i1. ; Verify that SROA creates a variable piece when splitting i1.
; CHECK: call void @llvm.dbg.value(metadata i64 %outer.coerce0, metadata ![[O:[0-9]+]], metadata ![[PIECE1:[0-9]+]]), ; CHECK: call void @llvm.dbg.value(metadata i64 %outer.coerce0, metadata ![[O:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64)),
; CHECK: call void @llvm.dbg.value(metadata i64 %outer.coerce1, metadata ![[O]], metadata ![[PIECE2:[0-9]+]]), ; CHECK: call void @llvm.dbg.value(metadata i64 %outer.coerce1, metadata ![[O]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)),
; CHECK: call void @llvm.dbg.value({{.*}}, metadata ![[I1:[0-9]+]], metadata ![[PIECE3:[0-9]+]]), ; CHECK: call void @llvm.dbg.value({{.*}}, metadata ![[I1:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 32)),
; CHECK-DAG: ![[O]] = !DILocalVariable(name: "outer",{{.*}} line: 10 ; CHECK-DAG: ![[O]] = !DILocalVariable(name: "outer",{{.*}} line: 10
; CHECK-DAG: ![[PIECE1]] = !DIExpression(DW_OP_LLVM_fragment, 0, 64)
; CHECK-DAG: ![[PIECE2]] = !DIExpression(DW_OP_LLVM_fragment, 64, 64)
; CHECK-DAG: ![[I1]] = !DILocalVariable(name: "i1",{{.*}} line: 11 ; CHECK-DAG: ![[I1]] = !DILocalVariable(name: "i1",{{.*}} line: 11
; CHECK-DAG: ![[PIECE3]] = !DIExpression(DW_OP_LLVM_fragment, 0, 32)
; ModuleID = 'sroasplit-2.c' ; ModuleID = 'sroasplit-2.c'
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"

View File

@ -3,10 +3,8 @@
; Test that SROA updates the debug info correctly if an alloca was rewritten but ; Test that SROA updates the debug info correctly if an alloca was rewritten but
; not partitioned into multiple allocas. ; not partitioned into multiple allocas.
; ;
; CHECK: call void @llvm.dbg.value(metadata float %s.coerce, metadata ![[VAR:[0-9]+]], metadata ![[EXPR:[0-9]+]]) ; CHECK: call void @llvm.dbg.value(metadata float %s.coerce, metadata ![[VAR:[0-9]+]], metadata !DIExpression())
; CHECK: ![[VAR]] = !DILocalVariable(name: "s",{{.*}} line: 3, ; CHECK: ![[VAR]] = !DILocalVariable(name: "s",{{.*}} line: 3,
; CHECK: ![[EXPR]] = !DIExpression(
; CHECK-NOT: DW_OP_LLVM_fragment
; ;
; struct S { float f; }; ; struct S { float f; };

View File

@ -2,15 +2,11 @@
; ;
; Test that recursively splitting an alloca updates the debug info correctly. ; Test that recursively splitting an alloca updates the debug info correctly.
; CHECK: %[[T:.*]] = load i64, i64* @t, align 8 ; CHECK: %[[T:.*]] = load i64, i64* @t, align 8
; CHECK: call void @llvm.dbg.value(metadata i64 %[[T]], metadata ![[Y:.*]], metadata ![[P1:.*]]) ; CHECK: call void @llvm.dbg.value(metadata i64 %[[T]], metadata ![[Y:.*]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 64))
; CHECK: %[[T1:.*]] = load i64, i64* @t, align 8 ; CHECK: %[[T1:.*]] = load i64, i64* @t, align 8
; CHECK: call void @llvm.dbg.value(metadata i64 %[[T1]], metadata ![[Y]], metadata ![[P2:.*]]) ; CHECK: call void @llvm.dbg.value(metadata i64 %[[T1]], metadata ![[Y]], metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64))
; CHECK: call void @llvm.dbg.value(metadata i64 %[[T]], metadata ![[R:.*]], metadata ![[P3:.*]]) ; CHECK: call void @llvm.dbg.value(metadata i64 %[[T]], metadata ![[R:.*]], metadata !DIExpression(DW_OP_LLVM_fragment, 192, 64))
; CHECK: call void @llvm.dbg.value(metadata i64 %[[T1]], metadata ![[R]], metadata ![[P4:.*]]) ; CHECK: call void @llvm.dbg.value(metadata i64 %[[T1]], metadata ![[R]], metadata !DIExpression(DW_OP_LLVM_fragment, 256, 64))
; CHECK: ![[P1]] = !DIExpression(DW_OP_LLVM_fragment, 0, 64)
; CHECK: ![[P2]] = !DIExpression(DW_OP_LLVM_fragment, 64, 64)
; CHECK: ![[P3]] = !DIExpression(DW_OP_LLVM_fragment, 192, 64)
; CHECK: ![[P4]] = !DIExpression(DW_OP_LLVM_fragment, 256, 64)
; ;
; struct p { ; struct p {
; __SIZE_TYPE__ s; ; __SIZE_TYPE__ s;

View File

@ -24,9 +24,9 @@ entry:
; CHECK: entry: ; CHECK: entry:
; Verify that llvm.dbg.declare calls are in the entry basic block. ; Verify that llvm.dbg.declare calls are in the entry basic block.
; CHECK-NOT: %entry ; CHECK-NOT: %entry
; CHECK: call void @llvm.dbg.declare(metadata {{.*}}, metadata ![[ARG_ID:[0-9]+]], metadata ![[EMPTY:[0-9]+]]) ; CHECK: call void @llvm.dbg.declare(metadata {{.*}}, metadata ![[ARG_ID:[0-9]+]], metadata !DIExpression())
; CHECK-NOT: %entry ; CHECK-NOT: %entry
; CHECK: call void @llvm.dbg.declare(metadata {{.*}}, metadata ![[VAR_ID:[0-9]+]], metadata ![[EMPTY:[0-9]+]]) ; CHECK: call void @llvm.dbg.declare(metadata {{.*}}, metadata ![[VAR_ID:[0-9]+]], metadata !DIExpression())
declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
@ -47,7 +47,6 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
; Verify that debug descriptors for argument and local variable will be replaced ; Verify that debug descriptors for argument and local variable will be replaced
; with descriptors that end with OpDeref (encoded as 2). ; with descriptors that end with OpDeref (encoded as 2).
; CHECK: ![[ARG_ID]] = !DILocalVariable(name: "p", arg: 1,{{.*}} line: 1 ; CHECK: ![[ARG_ID]] = !DILocalVariable(name: "p", arg: 1,{{.*}} line: 1
; CHECK: ![[EMPTY]] = !DIExpression()
; CHECK: ![[VAR_ID]] = !DILocalVariable(name: "r",{{.*}} line: 2 ; CHECK: ![[VAR_ID]] = !DILocalVariable(name: "r",{{.*}} line: 2
; Verify that there are no more variable descriptors. ; Verify that there are no more variable descriptors.
; CHECK-NOT: !DILocalVariable(tag: DW_TAG_arg_variable ; CHECK-NOT: !DILocalVariable(tag: DW_TAG_arg_variable

View File

@ -15,9 +15,8 @@ define void @use1() {
} }
; CHECK: [[A]] = !DIGlobalVariableExpression(var: [[AVAR:![0-9]+]]) ; CHECK: [[A]] = !DIGlobalVariableExpression(var: [[AVAR:![0-9]+]])
; CHECK: [[AVAR]] = !DIGlobalVariable(name: "a", scope: null, type: !2, isLocal: false, isDefinition: true) ; CHECK: [[AVAR]] = !DIGlobalVariable(name: "a", scope: null, type: !2, isLocal: false, isDefinition: true)
; CHECK: [[B]] = !DIGlobalVariableExpression(var: [[BVAR:![0-9]+]], expr: [[EXPR:![0-9]+]]) ; CHECK: [[B]] = !DIGlobalVariableExpression(var: [[BVAR:![0-9]+]], expr: !DIExpression(DW_OP_plus_uconst, 4))
; CHECK: [[BVAR]] = !DIGlobalVariable(name: "b", scope: null, type: !2, isLocal: false, isDefinition: true) ; CHECK: [[BVAR]] = !DIGlobalVariable(name: "b", scope: null, type: !2, isLocal: false, isDefinition: true)
; CHECK: [[EXPR]] = !DIExpression(DW_OP_plus_uconst, 4)
!llvm.module.flags = !{!4, !5} !llvm.module.flags = !{!4, !5}

View File

@ -43,7 +43,7 @@ define void @bar(float* %dst) #0 !dbg !9 {
entry: entry:
; CHECK: [[x_addr_i:%[a-zA-Z0-9.]+]] = alloca float, align 4 ; CHECK: [[x_addr_i:%[a-zA-Z0-9.]+]] = alloca float, align 4
; CHECK-NEXT: void @llvm.dbg.declare(metadata float* [[x_addr_i]], metadata [[m23:![0-9]+]], metadata !{{[0-9]+}}), !dbg [[m24:![0-9]+]] ; CHECK-NEXT: void @llvm.dbg.declare(metadata float* [[x_addr_i]], metadata [[m23:![0-9]+]], metadata !DIExpression()), !dbg [[m24:![0-9]+]]
%dst.addr = alloca float*, align 4 %dst.addr = alloca float*, align 4
store float* %dst, float** %dst.addr, align 4 store float* %dst, float** %dst.addr, align 4

View File

@ -32,7 +32,7 @@ entry:
; CHECK: define void @salvage_load ; CHECK: define void @salvage_load
; CHECK-NEXT: entry: ; CHECK-NEXT: entry:
; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry** %queue, ; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry** %queue,
; CHECK-SAME: metadata ![[LOAD_EXPR:[0-9]+]]) ; CHECK-SAME: metadata !DIExpression(DW_OP_deref, DW_OP_plus_uconst, 0))
store %struct.entry* %1, %struct.entry** %im_not_dead, align 8 store %struct.entry* %1, %struct.entry** %im_not_dead, align 8
ret void, !dbg !21 ret void, !dbg !21
} }
@ -46,7 +46,7 @@ entry:
; CHECK: define void @salvage_bitcast ; CHECK: define void @salvage_bitcast
; CHECK-NEXT: entry: ; CHECK-NEXT: entry:
; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue, ; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue,
; CHECK-SAME: metadata ![[BITCAST_EXPR:[0-9]+]]) ; CHECK-SAME: metadata !DIExpression(DW_OP_plus_uconst, 0))
store i8* %1, i8** %im_not_dead, align 8 store i8* %1, i8** %im_not_dead, align 8
ret void, !dbg !23 ret void, !dbg !23
} }
@ -60,7 +60,7 @@ entry:
; CHECK: define void @salvage_gep0 ; CHECK: define void @salvage_gep0
; CHECK-NEXT: entry: ; CHECK-NEXT: entry:
; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue, ; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue,
; CHECK-SAME: metadata ![[GEP0_EXPR:[0-9]+]]) ; CHECK-SAME: metadata !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_plus_uconst, 0, DW_OP_stack_value))
store %struct.entry** %1, %struct.entry*** %im_not_dead, align 8 store %struct.entry** %1, %struct.entry*** %im_not_dead, align 8
ret void, !dbg !26 ret void, !dbg !26
} }
@ -74,7 +74,7 @@ entry:
; CHECK: define void @salvage_gep1 ; CHECK: define void @salvage_gep1
; CHECK-NEXT: entry: ; CHECK-NEXT: entry:
; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue, ; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue,
; CHECK-SAME: metadata ![[GEP1_EXPR:[0-9]+]]) ; CHECK-SAME: metadata !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_stack_value, DW_OP_LLVM_fragment, 0, 32))
store %struct.entry** %1, %struct.entry*** %im_not_dead, align 8 store %struct.entry** %1, %struct.entry*** %im_not_dead, align 8
ret void, !dbg !29 ret void, !dbg !29
} }
@ -88,18 +88,11 @@ entry:
; CHECK: define void @salvage_gep2 ; CHECK: define void @salvage_gep2
; CHECK-NEXT: entry: ; CHECK-NEXT: entry:
; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue, ; CHECK-NEXT: call void @llvm.dbg.value(metadata %struct.entry* %queue,
; CHECK-SAME: metadata ![[GEP2_EXPR:[0-9]+]]) ; CHECK-SAME: metadata !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_stack_value))
store %struct.entry** %1, %struct.entry*** %im_not_dead, align 8 store %struct.entry** %1, %struct.entry*** %im_not_dead, align 8
ret void, !dbg !32 ret void, !dbg !32
} }
; CHECK: ![[LOAD_EXPR]] = !DIExpression(DW_OP_deref, DW_OP_plus_uconst, 0)
; CHECK: ![[BITCAST_EXPR]] = !DIExpression(DW_OP_plus_uconst, 0)
; CHECK: ![[GEP0_EXPR]] = !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_plus_uconst, 0, DW_OP_stack_value)
; CHECK: ![[GEP1_EXPR]] = !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_stack_value,
; CHECK-SAME: DW_OP_LLVM_fragment, 0, 32)
; CHECK: ![[GEP2_EXPR]] = !DIExpression(DW_OP_constu, 8, DW_OP_minus, DW_OP_stack_value)
; Function Attrs: nounwind readnone ; Function Attrs: nounwind readnone
declare void @llvm.dbg.value(metadata, metadata, metadata) #1 declare void @llvm.dbg.value(metadata, metadata, metadata) #1

View File

@ -3,10 +3,12 @@
;CHECK-LABEL: func ;CHECK-LABEL: func
;CHECK-LABEL: entry ;CHECK-LABEL: entry
;CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 %a ;CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 %a
;CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 1, metadata !13, metadata !11), !dbg !15 ;CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 1, metadata ![[I_VAR:[0-9]+]], metadata !DIExpression())
;CHECK-LABEL: for.body: ;CHECK-LABEL: for.body:
;CHECK-NEXT: [[I:%.*]] = phi i32 [ 1, %entry ], [ %inc, %for.body ] ;CHECK-NEXT: [[I:%.*]] = phi i32 [ 1, %entry ], [ %inc, %for.body ]
;CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 [[I]], metadata !13, metadata !11), !dbg !15 ;CHECK-NEXT: tail call void @llvm.dbg.value(metadata i32 [[I]], metadata ![[I_VAR]], metadata !DIExpression())
; CHECK: ![[I_VAR]] = !DILocalVariable(name: "i",{{.*}})
; Function Attrs: noinline nounwind ; Function Attrs: noinline nounwind
define void @func(i32 %a) local_unnamed_addr #0 !dbg !6 { define void @func(i32 %a) local_unnamed_addr #0 !dbg !6 {

View File

@ -14,17 +14,15 @@ for.cond:
; CHECK: %[[PHI:.*]] = phi i8 [ 0, %entry ], [ %0, %for.cond ] ; CHECK: %[[PHI:.*]] = phi i8 [ 0, %entry ], [ %0, %for.cond ]
%entryN = load i8, i8* %entry1, align 8, !dbg !20 %entryN = load i8, i8* %entry1, align 8, !dbg !20
; CHECK: call void @llvm.dbg.value(metadata i8 %[[PHI]], ; CHECK: call void @llvm.dbg.value(metadata i8 %[[PHI]],
; CHECK-SAME: metadata ![[EXPR:[0-9]+]]) ; CHECK-SAME: metadata !DIExpression())
%0 = add i8 %entryN, 1 %0 = add i8 %entryN, 1
; CHECK: %0 = add i8 %[[PHI]], 1 ; CHECK: %0 = add i8 %[[PHI]], 1
; CHECK: call void @llvm.dbg.value(metadata i8 %0, ; CHECK: call void @llvm.dbg.value(metadata i8 %0,
; CHECK-SAME: metadata ![[EXPR]]) ; CHECK-SAME: metadata !DIExpression())
store i8 %0, i8* %entry1, align 8, !dbg !20 store i8 %0, i8* %entry1, align 8, !dbg !20
br label %for.cond, !dbg !20 br label %for.cond, !dbg !20
} }
; CHECK: ![[EXPR]] = !DIExpression()
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
attributes #0 = { nounwind ssp uwtable } attributes #0 = { nounwind ssp uwtable }

View File

@ -87,17 +87,17 @@ define i32 @maxB(i32 %x, i32 %y) !dbg !34 {
; OPTIMIZATION_LEVEL_0-NEXT: %x.addr = alloca i32, align 4 ; OPTIMIZATION_LEVEL_0-NEXT: %x.addr = alloca i32, align 4
; OPTIMIZATION_LEVEL_0-NEXT: %y.addr = alloca i32, align 4 ; OPTIMIZATION_LEVEL_0-NEXT: %y.addr = alloca i32, align 4
; OPTIMIZATION_LEVEL_0-NEXT: store i32 %x, i32* %x.addr, align 4 ; OPTIMIZATION_LEVEL_0-NEXT: store i32 %x, i32* %x.addr, align 4
; OPTIMIZATION_LEVEL_0-NEXT: call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !{{[0-9]+}}, metadata !{{[0-9]+}}), !dbg !{{[0-9]+}} ; OPTIMIZATION_LEVEL_0-NEXT: call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !{{[0-9]+}}, metadata !DIExpression()), !dbg !{{[0-9]+}}
; OPTIMIZATION_LEVEL_0-NEXT: store i32 %y, i32* %y.addr, align 4 ; OPTIMIZATION_LEVEL_0-NEXT: store i32 %y, i32* %y.addr, align 4
; OPTIMIZATION_LEVEL_0-NEXT: call void @llvm.dbg.declare(metadata i32* %y.addr, metadata !{{[0-9]+}}, metadata !{{[0-9]+}}), !dbg !{{[0-9]+}} ; OPTIMIZATION_LEVEL_0-NEXT: call void @llvm.dbg.declare(metadata i32* %y.addr, metadata !{{[0-9]+}}, metadata !DIExpression()), !dbg !{{[0-9]+}}
; OPTIMIZATION_LEVEL_0-NEXT: %0 = tail call i32 @maxA(i32 %x, i32 %y), !dbg !{{[0-9]+}} ; OPTIMIZATION_LEVEL_0-NEXT: %0 = tail call i32 @maxA(i32 %x, i32 %y), !dbg !{{[0-9]+}}
; OPTIMIZATION_LEVEL_0-NEXT: ret i32 %0, !dbg !{{[0-9]+}} ; OPTIMIZATION_LEVEL_0-NEXT: ret i32 %0, !dbg !{{[0-9]+}}
; OPTIMIZATION_LEVEL_0-NEXT: } ; OPTIMIZATION_LEVEL_0-NEXT: }
; OPTIMIZATION_LEVEL_2: define i32 @maxB(i32 %x, i32 %y) ; OPTIMIZATION_LEVEL_2: define i32 @maxB(i32 %x, i32 %y)
; OPTIMIZATION_LEVEL_2-NEXT: entry: ; OPTIMIZATION_LEVEL_2-NEXT: entry:
; OPTIMIZATION_LEVEL_2-NEXT: tail call void @llvm.dbg.value(metadata i32 %x, metadata !{{[0-9]+}}, metadata !{{[0-9]+}}), !dbg !{{[0-9]+}} ; OPTIMIZATION_LEVEL_2-NEXT: tail call void @llvm.dbg.value(metadata i32 %x, metadata !{{[0-9]+}}, metadata !DIExpression()), !dbg !{{[0-9]+}}
; OPTIMIZATION_LEVEL_2-NEXT: tail call void @llvm.dbg.value(metadata i32 %y, metadata !{{[0-9]+}}, metadata !{{[0-9]+}}), !dbg !{{[0-9]+}} ; OPTIMIZATION_LEVEL_2-NEXT: tail call void @llvm.dbg.value(metadata i32 %y, metadata !{{[0-9]+}}, metadata !DIExpression()), !dbg !{{[0-9]+}}
; OPTIMIZATION_LEVEL_2-NEXT: %0 = tail call i32 @maxA(i32 %x, i32 %y) #{{[0-9]+}}, !dbg !{{[0-9]+}} ; OPTIMIZATION_LEVEL_2-NEXT: %0 = tail call i32 @maxA(i32 %x, i32 %y) #{{[0-9]+}}, !dbg !{{[0-9]+}}
; OPTIMIZATION_LEVEL_2-NEXT: ret i32 %0, !dbg !{{[0-9]+}} ; OPTIMIZATION_LEVEL_2-NEXT: ret i32 %0, !dbg !{{[0-9]+}}
; OPTIMIZATION_LEVEL_2-NEXT: } ; OPTIMIZATION_LEVEL_2-NEXT: }

View File

@ -11,9 +11,8 @@ entry:
; Checks that SROA still inserts a bit_piece expression, even if it produces only one piece ; Checks that SROA still inserts a bit_piece expression, even if it produces only one piece
; (as long as that piece is smaller than the whole thing) ; (as long as that piece is smaller than the whole thing)
; CHECK-NOT: call void @llvm.dbg.value ; CHECK-NOT: call void @llvm.dbg.value
; CHECK: call void @llvm.dbg.value(metadata %foo* undef, {{.*}}, metadata ![[BIT_PIECE:[0-9]+]]), !dbg ; CHECK: call void @llvm.dbg.value(metadata %foo* undef, {{.*}}, metadata !DIExpression(DW_OP_LLVM_fragment, 64, 64)), !dbg
; CHECK-NOT: call void @llvm.dbg.value ; CHECK-NOT: call void @llvm.dbg.value
; CHECK: ![[BIT_PIECE]] = !DIExpression(DW_OP_LLVM_fragment, 64, 64)
%0 = bitcast %foo* %retval to i8* %0 = bitcast %foo* %retval to i8*
%1 = getelementptr inbounds i8, i8* %0, i64 8 %1 = getelementptr inbounds i8, i8* %0, i64 8
%2 = bitcast i8* %1 to %foo** %2 = bitcast i8* %1 to %foo**

View File

@ -14,7 +14,7 @@ entry:
%0 = zext i32 %n to i64, !dbg !16 %0 = zext i32 %n to i64, !dbg !16
; CHECK: store i8* %[[VLA:.*]], i8** @__safestack_unsafe_stack_ptr ; CHECK: store i8* %[[VLA:.*]], i8** @__safestack_unsafe_stack_ptr
; CHECK: tail call void @llvm.dbg.value(metadata i8* %[[VLA]], metadata ![[TYPE:.*]], metadata ![[EXPR:.*]]) ; CHECK: tail call void @llvm.dbg.value(metadata i8* %[[VLA]], metadata ![[TYPE:.*]], metadata !DIExpression(DW_OP_deref))
; CHECK: call void @capture({{.*}} %[[VLA]]) ; CHECK: call void @capture({{.*}} %[[VLA]])
%vla = alloca i8, i64 %0, align 16, !dbg !16 %vla = alloca i8, i64 %0, align 16, !dbg !16
@ -50,7 +50,6 @@ declare void @llvm.dbg.value(metadata, metadata, metadata)
!15 = !DILocation(line: 2, column: 12, scope: !6) !15 = !DILocation(line: 2, column: 12, scope: !6)
!16 = !DILocation(line: 3, column: 3, scope: !6) !16 = !DILocation(line: 3, column: 3, scope: !6)
; CHECK-DAG: ![[EXPR]] = !DIExpression(DW_OP_deref)
!17 = !DIExpression(DW_OP_deref) !17 = !DIExpression(DW_OP_deref)
!18 = !DILocation(line: 3, column: 8, scope: !6) !18 = !DILocation(line: 3, column: 8, scope: !6)
!19 = !DILocation(line: 4, column: 3, scope: !6) !19 = !DILocation(line: 4, column: 3, scope: !6)

View File

@ -20,9 +20,9 @@ entry:
; dbg.declare for %zzz and %xxx are gone; replaced with dbg.declare based off the unsafe stack pointer ; dbg.declare for %zzz and %xxx are gone; replaced with dbg.declare based off the unsafe stack pointer
; CHECK-NOT: call void @llvm.dbg.declare ; CHECK-NOT: call void @llvm.dbg.declare
; CHECK: call void @llvm.dbg.declare(metadata i8* %[[USP]], metadata ![[VAR_ARG:.*]], metadata ![[EXPR_ARG:.*]]) ; CHECK: call void @llvm.dbg.declare(metadata i8* %[[USP]], metadata ![[VAR_ARG:.*]], metadata !DIExpression(DW_OP_constu, 104, DW_OP_minus))
; CHECK-NOT: call void @llvm.dbg.declare ; CHECK-NOT: call void @llvm.dbg.declare
; CHECK: call void @llvm.dbg.declare(metadata i8* %[[USP]], metadata ![[VAR_LOCAL:.*]], metadata ![[EXPR_LOCAL:.*]]) ; CHECK: call void @llvm.dbg.declare(metadata i8* %[[USP]], metadata ![[VAR_LOCAL:.*]], metadata !DIExpression(DW_OP_constu, 208, DW_OP_minus))
; CHECK-NOT: call void @llvm.dbg.declare ; CHECK-NOT: call void @llvm.dbg.declare
call void @Capture(%struct.S* %zzz), !dbg !23 call void @Capture(%struct.S* %zzz), !dbg !23
@ -37,10 +37,8 @@ entry:
; CHECK-DAG: ![[VAR_ARG]] = !DILocalVariable(name: "zzz" ; CHECK-DAG: ![[VAR_ARG]] = !DILocalVariable(name: "zzz"
; 100 aligned up to 8 ; 100 aligned up to 8
; CHECK-DAG: ![[EXPR_ARG]] = !DIExpression(DW_OP_constu, 104, DW_OP_minus
; CHECK-DAG: ![[VAR_LOCAL]] = !DILocalVariable(name: "xxx" ; CHECK-DAG: ![[VAR_LOCAL]] = !DILocalVariable(name: "xxx"
; CHECK-DAG: ![[EXPR_LOCAL]] = !DIExpression(DW_OP_constu, 208, DW_OP_minus
; Function Attrs: nounwind readnone ; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1

View File

@ -25,7 +25,7 @@ entry:
tail call void @llvm.dbg.value(metadata i32* %x1, metadata !10, metadata !24), !dbg !16 tail call void @llvm.dbg.value(metadata i32* %x1, metadata !10, metadata !24), !dbg !16
; Supported dbg.value: rewritted based on the [[USP]] value. ; Supported dbg.value: rewritted based on the [[USP]] value.
; CHECK: call void @llvm.dbg.value(metadata i8* %[[USP]], metadata ![[X1:.*]], metadata ![[X1_EXPR:.*]]) ; CHECK: call void @llvm.dbg.value(metadata i8* %[[USP]], metadata ![[X1:.*]], metadata !DIExpression(DW_OP_deref, DW_OP_constu, 4, DW_OP_minus))
tail call void @llvm.dbg.value(metadata i32* %x1, metadata !10, metadata !15), !dbg !16 tail call void @llvm.dbg.value(metadata i32* %x1, metadata !10, metadata !15), !dbg !16
call void @capture(i32* nonnull %x1), !dbg !17 call void @capture(i32* nonnull %x1), !dbg !17
@ -33,7 +33,7 @@ entry:
; CHECK: call void @llvm.random.metadata.use(metadata ![[EMPTY]]) ; CHECK: call void @llvm.random.metadata.use(metadata ![[EMPTY]])
call void @llvm.random.metadata.use(metadata i32* %x2) call void @llvm.random.metadata.use(metadata i32* %x2)
; CHECK: call void @llvm.dbg.value(metadata i8* %[[USP]], metadata ![[X2:.*]], metadata ![[X2_EXPR:.*]]) ; CHECK: call void @llvm.dbg.value(metadata i8* %[[USP]], metadata ![[X2:.*]], metadata !DIExpression(DW_OP_deref, DW_OP_constu, 8, DW_OP_minus))
call void @llvm.dbg.value(metadata i32* %x2, metadata !12, metadata !15), !dbg !18 call void @llvm.dbg.value(metadata i32* %x2, metadata !12, metadata !15), !dbg !18
call void @capture(i32* nonnull %x2), !dbg !19 call void @capture(i32* nonnull %x2), !dbg !19
ret void, !dbg !20 ret void, !dbg !20
@ -84,8 +84,6 @@ attributes #4 = { nounwind }
!13 = !DILocation(line: 5, column: 3, scope: !6) !13 = !DILocation(line: 5, column: 3, scope: !6)
!14 = !DILocation(line: 6, column: 3, scope: !6) !14 = !DILocation(line: 6, column: 3, scope: !6)
; CHECK-DAG: ![[X1_EXPR]] = !DIExpression(DW_OP_deref, DW_OP_constu, 4, DW_OP_minus)
; CHECK-DAG: ![[X2_EXPR]] = !DIExpression(DW_OP_deref, DW_OP_constu, 8, DW_OP_minus)
!15 = !DIExpression(DW_OP_deref) !15 = !DIExpression(DW_OP_deref)
!16 = !DILocation(line: 5, column: 7, scope: !6) !16 = !DILocation(line: 5, column: 7, scope: !6)
!17 = !DILocation(line: 8, column: 3, scope: !6) !17 = !DILocation(line: 8, column: 3, scope: !6)

View File

@ -19,14 +19,10 @@
; parameter. It can reference the register it's in directly without masking off ; parameter. It can reference the register it's in directly without masking off
; high bits or anything ; high bits or anything
; CHECK: call void @llvm.dbg.value(metadata i8 %g.coerce0, metadata ![[VAR_STRUCT:[0-9]+]], metadata ![[EXPR_STRUCT1:[0-9]+]]) ; CHECK: call void @llvm.dbg.value(metadata i8 %g.coerce0, metadata ![[VAR_STRUCT:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 8))
; CHECK: call void @llvm.dbg.value(metadata i64 %g.coerce1, metadata ![[VAR_STRUCT]], metadata ![[EXPR_STRUCT2:[0-9]+]]) ; CHECK: call void @llvm.dbg.value(metadata i64 %g.coerce1, metadata ![[VAR_STRUCT]], metadata !DIExpression(DW_OP_LLVM_fragment, 32, 64))
; CHECK: call void @llvm.dbg.value(metadata i1 %b, metadata ![[VAR_BOOL:[0-9]+]], metadata ![[EXPR_BOOL:[0-9]+]]) ; CHECK: call void @llvm.dbg.value(metadata i1 %b, metadata ![[VAR_BOOL:[0-9]+]], metadata !DIExpression())
; CHECK: call void @llvm.dbg.value(metadata i1 %frag, metadata ![[FRAG_BOOL:[0-9]+]], metadata ![[FRAG_BOOL:[0-9]+]]) ; CHECK: call void @llvm.dbg.value(metadata i1 %frag, metadata ![[VAR_FRAG:[0-9]+]], metadata !DIExpression(DW_OP_LLVM_fragment, 0, 1))
; CHECK: ![[EXPR_STRUCT1]] = !DIExpression(DW_OP_LLVM_fragment, 0, 8)
; CHECK: ![[EXPR_STRUCT2]] = !DIExpression(DW_OP_LLVM_fragment, 32, 64)
; CHECK: ![[EXPR_BOOL]] = !DIExpression()
; CHECK: ![[FRAG_BOOL]] = !DIExpression(DW_OP_LLVM_fragment, 0, 1)
%struct.foo = type { i8, i64 } %struct.foo = type { i8, i64 }