2017-08-02 08:28:10 +08:00
|
|
|
; RUN: llc -mtriple=x86_64-linux < %s | FileCheck %s
|
|
|
|
; RUN: opt -strip-debug < %s | llc -mtriple=x86_64-linux | FileCheck %s
|
2014-03-27 06:15:28 +08:00
|
|
|
; http://llvm.org/PR19051. Minor code-motion difference with -g.
|
|
|
|
; Presence of debug info shouldn't affect the codegen. Make sure that
|
|
|
|
; we generated the same code sequence with and without debug info.
|
|
|
|
;
|
|
|
|
; CHECK: callq _Z3fooPcjPKc
|
|
|
|
; CHECK: callq _Z3fooPcjPKc
|
2016-09-26 14:42:07 +08:00
|
|
|
; CHECK: movq %rsp, %rdi
|
2014-03-27 06:15:28 +08:00
|
|
|
; CHECK: testl {{%[a-z]+}}, {{%[a-z]+}}
|
|
|
|
; CHECK: je .LBB0_4
|
Bias physical register immediate assignments
The machine scheduler currently biases register copies to/from
physical registers to be closer to their point of use / def to
minimize their live ranges. This change extends this to also physical
register assignments from immediate values.
This causes a reduction in reduction in overall register pressure and
minor reduction in spills and indirectly fixes an out-of-registers
assertion (PR39391).
Most test changes are from minor instruction reorderings and register
name selection changes and direct consequences of that.
Reviewers: MatzeB, qcolombet, myatsina, pcc
Subscribers: nemanjai, jvesely, nhaehnle, eraman, hiraditya,
javed.absar, arphaman, jfb, jsji, llvm-commits
Differential Revision: https://reviews.llvm.org/D54218
llvm-svn: 346894
2018-11-15 05:11:53 +08:00
|
|
|
; CHECK: movl $4, %esi
|
2014-03-27 06:15:28 +08:00
|
|
|
|
|
|
|
; Regenerate test with this command:
|
2016-01-15 08:46:17 +08:00
|
|
|
; clang++ -emit-llvm -S -O2 -g
|
2014-03-27 06:15:28 +08:00
|
|
|
; from this source:
|
|
|
|
;
|
|
|
|
; extern void foo(char *dst,unsigned siz,const char *src);
|
|
|
|
; extern const char * i2str(int);
|
|
|
|
;
|
|
|
|
; struct AAA3 {
|
|
|
|
; AAA3(const char *value) { foo(text,sizeof(text),value);}
|
|
|
|
; void operator=(const char *value) { foo(text,sizeof(text),value);}
|
|
|
|
; operator const char*() const { return text;}
|
|
|
|
; char text[4];
|
|
|
|
; };
|
|
|
|
;
|
|
|
|
; void bar (int param1,int param2) {
|
|
|
|
; const char * temp(0);
|
|
|
|
;
|
|
|
|
; if (param2) {
|
|
|
|
; temp = i2str(param2);
|
|
|
|
; }
|
|
|
|
; AAA3 var1("");
|
|
|
|
; AAA3 var2("");
|
|
|
|
;
|
|
|
|
; if (param1)
|
|
|
|
; var2 = "+";
|
|
|
|
; else
|
|
|
|
; var2 = "-";
|
|
|
|
; var1 = "";
|
|
|
|
; }
|
|
|
|
|
|
|
|
%struct.AAA3 = type { [4 x i8] }
|
|
|
|
|
|
|
|
@.str = private unnamed_addr constant [1 x i8] zeroinitializer, align 1
|
2016-01-15 08:46:17 +08:00
|
|
|
@.str.1 = private unnamed_addr constant [2 x i8] c"+\00", align 1
|
|
|
|
@.str.2 = private unnamed_addr constant [2 x i8] c"-\00", align 1
|
2014-03-27 06:15:28 +08:00
|
|
|
|
|
|
|
; Function Attrs: uwtable
|
2015-11-06 06:03:56 +08:00
|
|
|
define void @_Z3barii(i32 %param1, i32 %param2) #0 !dbg !24 {
|
2014-03-27 06:15:28 +08:00
|
|
|
entry:
|
|
|
|
%var1 = alloca %struct.AAA3, align 1
|
|
|
|
%var2 = alloca %struct.AAA3, align 1
|
2016-01-15 08:46:17 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata i32 %param1, i64 0, metadata !29, metadata !46), !dbg !47
|
|
|
|
tail call void @llvm.dbg.value(metadata i32 %param2, i64 0, metadata !30, metadata !46), !dbg !48
|
|
|
|
tail call void @llvm.dbg.value(metadata i8* null, i64 0, metadata !31, metadata !46), !dbg !49
|
Recommit r212203: Don't try to construct debug LexicalScopes hierarchy for functions that do not have top level debug information.
Reverted by Eric Christopher (Thanks!) in r212203 after Bob Wilson
reported LTO issues. Duncan Exon Smith and Aditya Nandakumar helped
provide a reduced reproduction, though the failure wasn't too hard to
guess, and even easier with the example to confirm.
The assertion that the subprogram metadata associated with an
llvm::Function matches the scope data referenced by the DbgLocs on the
instructions in that function is not valid under LTO. In LTO, a C++
inline function might exist in multiple CUs and the subprogram metadata
nodes will refer to the same llvm::Function. In this case, depending on
the order of the CUs, the first intance of the subprogram metadata may
not be the one referenced by the instructions in that function and the
assertion will fail.
A test case (test/DebugInfo/cross-cu-linkonce-distinct.ll) is added, the
assertion removed and a comment added to explain this situation.
This was then reverted again in r213581 as it caused PR20367. The root
cause of this was the early exit in LiveDebugVariables meant that
spurious DBG_VALUE intrinsics that referenced dead variables were not
removed, causing an assertion/crash later on. The fix is to have
LiveDebugVariables strip all DBG_VALUE intrinsics in functions without
debug info as they're not needed anyway. Test case added to cover this
situation (that occurs when a debug-having function is inlined into a
nodebug function) in test/DebugInfo/X86/nodebug_with_debug_loc.ll
Original commit message:
If a function isn't actually in a CU's subprogram list in the debug info
metadata, ignore all the DebugLocs and don't try to build scopes, track
variables, etc.
While this is possibly a minor optimization, it's also a correctness fix
for an incoming patch that will add assertions to LexicalScopes and the
debug info verifier to ensure that all scope chains lead to debug info
for the current function.
Fix up a few test cases that had broken/incomplete debug info that could
violate this constraint.
Add a test case where this occurs by design (inlining a
debug-info-having function in an attribute nodebug function - we want
this to work because /if/ the nodebug function is then inlined into a
debug-info-having function, it should be fine (and will work fine - we
just stitch the scopes up as usual), but should the inlining not happen
we need to not assert fail either).
llvm-svn: 213952
2014-07-26 00:10:16 +08:00
|
|
|
%tobool = icmp eq i32 %param2, 0, !dbg !50
|
2016-01-15 08:46:17 +08:00
|
|
|
br i1 %tobool, label %if.end, label %if.then, !dbg !52
|
2014-03-27 06:15:28 +08:00
|
|
|
|
|
|
|
if.then: ; preds = %entry
|
2016-01-15 08:46:17 +08:00
|
|
|
%call = tail call i8* @_Z5i2stri(i32 %param2), !dbg !53
|
|
|
|
tail call void @llvm.dbg.value(metadata i8* %call, i64 0, metadata !31, metadata !46), !dbg !49
|
|
|
|
br label %if.end, !dbg !55
|
2014-03-27 06:15:28 +08:00
|
|
|
|
|
|
|
if.end: ; preds = %entry, %if.then
|
2016-01-15 08:46:17 +08:00
|
|
|
%0 = getelementptr inbounds %struct.AAA3, %struct.AAA3* %var1, i64 0, i32 0, i64 0, !dbg !56
|
2017-04-11 04:18:21 +08:00
|
|
|
call void @llvm.lifetime.start.p0i8(i64 4, i8* %0) #4, !dbg !56
|
2016-01-15 08:46:17 +08:00
|
|
|
tail call void @llvm.dbg.value(metadata %struct.AAA3* %var1, i64 0, metadata !32, metadata !57), !dbg !58
|
|
|
|
tail call void @llvm.dbg.value(metadata %struct.AAA3* %var1, i64 0, metadata !36, metadata !46), !dbg !59
|
|
|
|
tail call void @llvm.dbg.value(metadata i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i64 0, metadata !38, metadata !46), !dbg !62
|
|
|
|
call void @_Z3fooPcjPKc(i8* %0, i32 4, i8* nonnull getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)), !dbg !63
|
|
|
|
%1 = getelementptr inbounds %struct.AAA3, %struct.AAA3* %var2, i64 0, i32 0, i64 0, !dbg !65
|
2017-04-11 04:18:21 +08:00
|
|
|
call void @llvm.lifetime.start.p0i8(i64 4, i8* %1) #4, !dbg !65
|
2016-01-15 08:46:17 +08:00
|
|
|
call void @llvm.dbg.value(metadata %struct.AAA3* %var2, i64 0, metadata !33, metadata !57), !dbg !66
|
|
|
|
call void @llvm.dbg.value(metadata %struct.AAA3* %var2, i64 0, metadata !36, metadata !46), !dbg !67
|
|
|
|
call void @llvm.dbg.value(metadata i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i64 0, metadata !38, metadata !46), !dbg !69
|
|
|
|
call void @_Z3fooPcjPKc(i8* %1, i32 4, i8* nonnull getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)), !dbg !70
|
|
|
|
%tobool1 = icmp eq i32 %param1, 0, !dbg !71
|
|
|
|
call void @llvm.dbg.value(metadata %struct.AAA3* %var2, i64 0, metadata !33, metadata !57), !dbg !66
|
|
|
|
call void @llvm.dbg.value(metadata %struct.AAA3* %var2, i64 0, metadata !41, metadata !46), !dbg !73
|
|
|
|
br i1 %tobool1, label %if.else, label %if.then2, !dbg !75
|
2014-03-27 06:15:28 +08:00
|
|
|
|
|
|
|
if.then2: ; preds = %if.end
|
2016-01-15 08:46:17 +08:00
|
|
|
call void @llvm.dbg.value(metadata i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i64 0, metadata !42, metadata !46), !dbg !76
|
|
|
|
call void @_Z3fooPcjPKc(i8* %1, i32 4, i8* nonnull getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)), !dbg !78
|
|
|
|
br label %if.end3, !dbg !79
|
2014-03-27 06:15:28 +08:00
|
|
|
|
|
|
|
if.else: ; preds = %if.end
|
2016-01-15 08:46:17 +08:00
|
|
|
call void @llvm.dbg.value(metadata i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i64 0, metadata !42, metadata !46), !dbg !80
|
|
|
|
call void @_Z3fooPcjPKc(i8* %1, i32 4, i8* nonnull getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0)), !dbg !81
|
2014-03-27 06:15:28 +08:00
|
|
|
br label %if.end3
|
|
|
|
|
|
|
|
if.end3: ; preds = %if.else, %if.then2
|
2016-01-15 08:46:17 +08:00
|
|
|
call void @llvm.dbg.value(metadata %struct.AAA3* %var1, i64 0, metadata !32, metadata !57), !dbg !58
|
|
|
|
call void @llvm.dbg.value(metadata %struct.AAA3* %var1, i64 0, metadata !41, metadata !46), !dbg !82
|
|
|
|
call void @llvm.dbg.value(metadata i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i64 0, metadata !42, metadata !46), !dbg !84
|
|
|
|
call void @_Z3fooPcjPKc(i8* %0, i32 4, i8* nonnull getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)), !dbg !85
|
2017-04-11 04:18:21 +08:00
|
|
|
call void @llvm.lifetime.end.p0i8(i64 4, i8* %1) #4, !dbg !86
|
|
|
|
call void @llvm.lifetime.end.p0i8(i64 4, i8* %0) #4, !dbg !87
|
2016-01-15 08:46:17 +08:00
|
|
|
ret void, !dbg !86
|
2014-03-27 06:15:28 +08:00
|
|
|
}
|
|
|
|
|
2016-01-15 08:46:17 +08:00
|
|
|
; Function Attrs: argmemonly nounwind
|
2017-04-11 04:18:21 +08:00
|
|
|
declare void @llvm.lifetime.start.p0i8(i64, i8* nocapture) #1
|
2014-03-27 06:15:28 +08:00
|
|
|
|
2016-01-15 08:46:17 +08:00
|
|
|
declare i8* @_Z5i2stri(i32) #2
|
|
|
|
|
|
|
|
; Function Attrs: argmemonly nounwind
|
2017-04-11 04:18:21 +08:00
|
|
|
declare void @llvm.lifetime.end.p0i8(i64, i8* nocapture) #1
|
2016-01-15 08:46:17 +08:00
|
|
|
|
|
|
|
declare void @_Z3fooPcjPKc(i8*, i32, i8*) #2
|
2014-03-27 06:15:28 +08:00
|
|
|
|
|
|
|
; Function Attrs: nounwind readnone
|
2016-01-15 08:46:17 +08:00
|
|
|
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #3
|
2014-03-27 06:15:28 +08:00
|
|
|
|
2016-01-15 08:46:17 +08:00
|
|
|
attributes #0 = { uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
|
|
|
attributes #1 = { argmemonly nounwind }
|
|
|
|
attributes #2 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
|
|
|
|
attributes #3 = { nounwind readnone }
|
|
|
|
attributes #4 = { nounwind }
|
Recommit r212203: Don't try to construct debug LexicalScopes hierarchy for functions that do not have top level debug information.
Reverted by Eric Christopher (Thanks!) in r212203 after Bob Wilson
reported LTO issues. Duncan Exon Smith and Aditya Nandakumar helped
provide a reduced reproduction, though the failure wasn't too hard to
guess, and even easier with the example to confirm.
The assertion that the subprogram metadata associated with an
llvm::Function matches the scope data referenced by the DbgLocs on the
instructions in that function is not valid under LTO. In LTO, a C++
inline function might exist in multiple CUs and the subprogram metadata
nodes will refer to the same llvm::Function. In this case, depending on
the order of the CUs, the first intance of the subprogram metadata may
not be the one referenced by the instructions in that function and the
assertion will fail.
A test case (test/DebugInfo/cross-cu-linkonce-distinct.ll) is added, the
assertion removed and a comment added to explain this situation.
This was then reverted again in r213581 as it caused PR20367. The root
cause of this was the early exit in LiveDebugVariables meant that
spurious DBG_VALUE intrinsics that referenced dead variables were not
removed, causing an assertion/crash later on. The fix is to have
LiveDebugVariables strip all DBG_VALUE intrinsics in functions without
debug info as they're not needed anyway. Test case added to cover this
situation (that occurs when a debug-having function is inlined into a
nodebug function) in test/DebugInfo/X86/nodebug_with_debug_loc.ll
Original commit message:
If a function isn't actually in a CU's subprogram list in the debug info
metadata, ignore all the DebugLocs and don't try to build scopes, track
variables, etc.
While this is possibly a minor optimization, it's also a correctness fix
for an incoming patch that will add assertions to LexicalScopes and the
debug info verifier to ensure that all scope chains lead to debug info
for the current function.
Fix up a few test cases that had broken/incomplete debug info that could
violate this constraint.
Add a test case where this occurs by design (inlining a
debug-info-having function in an attribute nodebug function - we want
this to work because /if/ the nodebug function is then inlined into a
debug-info-having function, it should be fine (and will work fine - we
just stitch the scopes up as usual), but should the inlining not happen
we need to not assert fail either).
llvm-svn: 213952
2014-07-26 00:10:16 +08:00
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
2016-01-15 08:46:17 +08:00
|
|
|
!llvm.module.flags = !{!43, !44}
|
|
|
|
!llvm.ident = !{!45}
|
Recommit r212203: Don't try to construct debug LexicalScopes hierarchy for functions that do not have top level debug information.
Reverted by Eric Christopher (Thanks!) in r212203 after Bob Wilson
reported LTO issues. Duncan Exon Smith and Aditya Nandakumar helped
provide a reduced reproduction, though the failure wasn't too hard to
guess, and even easier with the example to confirm.
The assertion that the subprogram metadata associated with an
llvm::Function matches the scope data referenced by the DbgLocs on the
instructions in that function is not valid under LTO. In LTO, a C++
inline function might exist in multiple CUs and the subprogram metadata
nodes will refer to the same llvm::Function. In this case, depending on
the order of the CUs, the first intance of the subprogram metadata may
not be the one referenced by the instructions in that function and the
assertion will fail.
A test case (test/DebugInfo/cross-cu-linkonce-distinct.ll) is added, the
assertion removed and a comment added to explain this situation.
This was then reverted again in r213581 as it caused PR20367. The root
cause of this was the early exit in LiveDebugVariables meant that
spurious DBG_VALUE intrinsics that referenced dead variables were not
removed, causing an assertion/crash later on. The fix is to have
LiveDebugVariables strip all DBG_VALUE intrinsics in functions without
debug info as they're not needed anyway. Test case added to cover this
situation (that occurs when a debug-having function is inlined into a
nodebug function) in test/DebugInfo/X86/nodebug_with_debug_loc.ll
Original commit message:
If a function isn't actually in a CU's subprogram list in the debug info
metadata, ignore all the DebugLocs and don't try to build scopes, track
variables, etc.
While this is possibly a minor optimization, it's also a correctness fix
for an incoming patch that will add assertions to LexicalScopes and the
debug info verifier to ensure that all scope chains lead to debug info
for the current function.
Fix up a few test cases that had broken/incomplete debug info that could
violate this constraint.
Add a test case where this occurs by design (inlining a
debug-info-having function in an attribute nodebug function - we want
this to work because /if/ the nodebug function is then inlined into a
debug-info-having function, it should be fine (and will work fine - we
just stitch the scopes up as usual), but should the inlining not happen
we need to not assert fail either).
llvm-svn: 213952
2014-07-26 00:10:16 +08:00
|
|
|
|
2016-04-15 23:57:41 +08:00
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 255993) (llvm/trunk 256074)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3)
|
2016-01-15 08:46:17 +08:00
|
|
|
!1 = !DIFile(filename: "test.cpp", directory: "/mnt/extra")
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
|
|
|
!2 = !{}
|
|
|
|
!3 = !{!4}
|
2016-01-15 08:46:17 +08:00
|
|
|
!4 = !DICompositeType(tag: DW_TAG_structure_type, name: "AAA3", file: !1, line: 4, size: 32, align: 8, elements: !5, identifier: "_ZTS4AAA3")
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
|
|
|
!5 = !{!6, !11, !17, !18}
|
2016-04-24 05:08:00 +08:00
|
|
|
!6 = !DIDerivedType(tag: DW_TAG_member, name: "text", scope: !4, file: !1, line: 8, baseType: !7, size: 32, align: 8)
|
2016-01-15 08:46:17 +08:00
|
|
|
!7 = !DICompositeType(tag: DW_TAG_array_type, baseType: !8, size: 32, align: 8, elements: !9)
|
|
|
|
!8 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
|
|
|
!9 = !{!10}
|
2015-04-30 00:38:44 +08:00
|
|
|
!10 = !DISubrange(count: 4)
|
2016-04-24 05:08:00 +08:00
|
|
|
!11 = !DISubprogram(name: "AAA3", scope: !4, file: !1, line: 5, type: !12, isLocal: false, isDefinition: false, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true)
|
2015-04-30 00:38:44 +08:00
|
|
|
!12 = !DISubroutineType(types: !13)
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
|
|
|
!13 = !{null, !14, !15}
|
2016-04-24 05:08:00 +08:00
|
|
|
!14 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
|
2016-01-15 08:46:17 +08:00
|
|
|
!15 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !16, size: 64, align: 64)
|
2015-04-30 00:38:44 +08:00
|
|
|
!16 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !8)
|
2016-04-24 05:08:00 +08:00
|
|
|
!17 = !DISubprogram(name: "operator=", linkageName: "_ZN4AAA3aSEPKc", scope: !4, file: !1, line: 6, type: !12, isLocal: false, isDefinition: false, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true)
|
|
|
|
!18 = !DISubprogram(name: "operator const char *", linkageName: "_ZNK4AAA3cvPKcEv", scope: !4, file: !1, line: 7, type: !19, isLocal: false, isDefinition: false, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: true)
|
2015-04-30 00:38:44 +08:00
|
|
|
!19 = !DISubroutineType(types: !20)
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
|
|
|
!20 = !{!15, !21}
|
2016-01-15 08:46:17 +08:00
|
|
|
!21 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !22, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer)
|
2016-04-24 05:08:00 +08:00
|
|
|
!22 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !4)
|
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
|
|
|
!24 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barii", scope: !1, file: !1, line: 11, type: !25, isLocal: false, isDefinition: true, scopeLine: 11, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !28)
|
2016-01-15 08:46:17 +08:00
|
|
|
!25 = !DISubroutineType(types: !26)
|
|
|
|
!26 = !{null, !27, !27}
|
|
|
|
!27 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
|
|
|
!28 = !{!29, !30, !31, !32, !33}
|
|
|
|
!29 = !DILocalVariable(name: "param1", arg: 1, scope: !24, file: !1, line: 11, type: !27)
|
|
|
|
!30 = !DILocalVariable(name: "param2", arg: 2, scope: !24, file: !1, line: 11, type: !27)
|
|
|
|
!31 = !DILocalVariable(name: "temp", scope: !24, file: !1, line: 12, type: !15)
|
2016-04-24 05:08:00 +08:00
|
|
|
!32 = !DILocalVariable(name: "var1", scope: !24, file: !1, line: 17, type: !4)
|
|
|
|
!33 = !DILocalVariable(name: "var2", scope: !24, file: !1, line: 18, type: !4)
|
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
|
|
|
!34 = distinct !DISubprogram(name: "AAA3", linkageName: "_ZN4AAA3C2EPKc", scope: !4, file: !1, line: 5, type: !12, isLocal: false, isDefinition: true, scopeLine: 5, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !11, retainedNodes: !35)
|
2016-01-15 08:46:17 +08:00
|
|
|
!35 = !{!36, !38}
|
|
|
|
!36 = !DILocalVariable(name: "this", arg: 1, scope: !34, type: !37, flags: DIFlagArtificial | DIFlagObjectPointer)
|
2016-04-24 05:08:00 +08:00
|
|
|
!37 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64, align: 64)
|
2016-01-15 08:46:17 +08:00
|
|
|
!38 = !DILocalVariable(name: "value", arg: 2, scope: !34, file: !1, line: 5, type: !15)
|
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
|
|
|
!39 = distinct !DISubprogram(name: "operator=", linkageName: "_ZN4AAA3aSEPKc", scope: !4, file: !1, line: 6, type: !12, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, declaration: !17, retainedNodes: !40)
|
2016-01-15 08:46:17 +08:00
|
|
|
!40 = !{!41, !42}
|
|
|
|
!41 = !DILocalVariable(name: "this", arg: 1, scope: !39, type: !37, flags: DIFlagArtificial | DIFlagObjectPointer)
|
|
|
|
!42 = !DILocalVariable(name: "value", arg: 2, scope: !39, file: !1, line: 6, type: !15)
|
|
|
|
!43 = !{i32 2, !"Dwarf Version", i32 4}
|
|
|
|
!44 = !{i32 2, !"Debug Info Version", i32 3}
|
|
|
|
!45 = !{!"clang version 3.8.0 (trunk 255993) (llvm/trunk 256074)"}
|
|
|
|
!46 = !DIExpression()
|
|
|
|
!47 = !DILocation(line: 11, column: 15, scope: !24)
|
|
|
|
!48 = !DILocation(line: 11, column: 26, scope: !24)
|
|
|
|
!49 = !DILocation(line: 12, column: 16, scope: !24)
|
|
|
|
!50 = !DILocation(line: 14, column: 7, scope: !51)
|
|
|
|
!51 = distinct !DILexicalBlock(scope: !24, file: !1, line: 14, column: 7)
|
|
|
|
!52 = !DILocation(line: 14, column: 7, scope: !24)
|
|
|
|
!53 = !DILocation(line: 15, column: 12, scope: !54)
|
|
|
|
!54 = distinct !DILexicalBlock(scope: !51, file: !1, line: 14, column: 15)
|
|
|
|
!55 = !DILocation(line: 16, column: 3, scope: !54)
|
|
|
|
!56 = !DILocation(line: 17, column: 3, scope: !24)
|
|
|
|
!57 = !DIExpression(DW_OP_deref)
|
|
|
|
!58 = !DILocation(line: 17, column: 8, scope: !24)
|
|
|
|
!59 = !DILocation(line: 0, scope: !34, inlinedAt: !60)
|
|
|
|
!60 = distinct !DILocation(line: 17, column: 8, scope: !61)
|
|
|
|
!61 = !DILexicalBlockFile(scope: !24, file: !1, discriminator: 1)
|
|
|
|
!62 = !DILocation(line: 5, column: 19, scope: !34, inlinedAt: !60)
|
|
|
|
!63 = !DILocation(line: 5, column: 28, scope: !64, inlinedAt: !60)
|
|
|
|
!64 = distinct !DILexicalBlock(scope: !34, file: !1, line: 5, column: 26)
|
|
|
|
!65 = !DILocation(line: 18, column: 3, scope: !24)
|
|
|
|
!66 = !DILocation(line: 18, column: 8, scope: !24)
|
|
|
|
!67 = !DILocation(line: 0, scope: !34, inlinedAt: !68)
|
|
|
|
!68 = distinct !DILocation(line: 18, column: 8, scope: !61)
|
|
|
|
!69 = !DILocation(line: 5, column: 19, scope: !34, inlinedAt: !68)
|
|
|
|
!70 = !DILocation(line: 5, column: 28, scope: !64, inlinedAt: !68)
|
|
|
|
!71 = !DILocation(line: 20, column: 7, scope: !72)
|
|
|
|
!72 = distinct !DILexicalBlock(scope: !24, file: !1, line: 20, column: 7)
|
|
|
|
!73 = !DILocation(line: 0, scope: !39, inlinedAt: !74)
|
|
|
|
!74 = distinct !DILocation(line: 23, column: 10, scope: !72)
|
|
|
|
!75 = !DILocation(line: 20, column: 7, scope: !24)
|
|
|
|
!76 = !DILocation(line: 6, column: 29, scope: !39, inlinedAt: !77)
|
|
|
|
!77 = distinct !DILocation(line: 21, column: 10, scope: !72)
|
|
|
|
!78 = !DILocation(line: 6, column: 38, scope: !39, inlinedAt: !77)
|
|
|
|
!79 = !DILocation(line: 21, column: 5, scope: !72)
|
|
|
|
!80 = !DILocation(line: 6, column: 29, scope: !39, inlinedAt: !74)
|
|
|
|
!81 = !DILocation(line: 6, column: 38, scope: !39, inlinedAt: !74)
|
|
|
|
!82 = !DILocation(line: 0, scope: !39, inlinedAt: !83)
|
|
|
|
!83 = distinct !DILocation(line: 24, column: 8, scope: !24)
|
|
|
|
!84 = !DILocation(line: 6, column: 29, scope: !39, inlinedAt: !83)
|
|
|
|
!85 = !DILocation(line: 6, column: 38, scope: !39, inlinedAt: !83)
|
|
|
|
!86 = !DILocation(line: 25, column: 1, scope: !24)
|
|
|
|
!87 = !DILocation(line: 25, column: 1, scope: !61)
|