2011-04-22 06:48:26 +08:00
; RUN: llc < %s - | FileCheck %s
; Radar 9309221
; Test dwarf reg no for s16
2015-01-13 06:19:22 +08:00
;CHECK: super-register DW_OP_regx
2015-03-03 06:02:33 +08:00
;CHECK-NEXT: 264
2014-02-28 01:56:08 +08:00
;CHECK-NEXT: DW_OP_piece
;CHECK-NEXT: 4
2011-04-22 06:48:26 +08:00
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:64-v128:32:128-a0:0:32-n32"
target triple = "thumbv7-apple-macosx10.6.7"
@.str = private unnamed_addr constant [ 11 x i8 ] c "%p %lf %c\0A\00"
@.str1 = private unnamed_addr constant [ 6 x i8 ] c "point\00"
2015-11-06 06:03:56 +08:00
define i32 @inlineprinter ( i8 * %ptr , float %val , i8 zeroext %c ) nounwind optsize ssp !dbg !0 {
2011-04-22 06:48:26 +08:00
entry:
2015-04-30 00:38:44 +08:00
tail call void @llvm.dbg.value ( metadata i8 * %ptr , i64 0 , metadata !8 , metadata !DIExpression ( ) ) , !dbg !24
tail call void @llvm.dbg.value ( metadata float %val , i64 0 , metadata !10 , metadata !DIExpression ( ) ) , !dbg !25
tail call void @llvm.dbg.value ( metadata i8 %c , i64 0 , metadata !12 , metadata !DIExpression ( ) ) , !dbg !26
2011-04-22 06:48:26 +08:00
%conv = fpext float %val to double , !dbg !27
%conv3 = zext i8 %c to i32 , !dbg !27
[opaque pointer type] Add textual IR support for explicit type parameter to the call instruction
See r230786 and r230794 for similar changes to gep and load
respectively.
Call is a bit different because it often doesn't have a single explicit
type - usually the type is deduced from the arguments, and just the
return type is explicit. In those cases there's no need to change the
IR.
When that's not the case, the IR usually contains the pointer type of
the first operand - but since typed pointers are going away, that
representation is insufficient so I'm just stripping the "pointerness"
of the explicit type away.
This does make the IR a bit weird - it /sort of/ reads like the type of
the first operand: "call void () %x(" but %x is actually of type "void
()*" and will eventually be just of type "ptr". But this seems not too
bad and I don't think it would benefit from repeating the type
("void (), void () * %x(" and then eventually "void (), ptr %x(") as has
been done with gep and load.
This also has a side benefit: since the explicit type is no longer a
pointer, there's no ambiguity between an explicit type and a function
that returns a function pointer. Previously this case needed an explicit
type (eg: a function returning a void() function was written as
"call void () () * @x(" rather than "call void () * @x(" because of the
ambiguity between a function returning a pointer to a void() function
and a function returning void).
No ambiguity means even function pointer return types can just be
written alone, without writing the whole function's type.
This leaves /only/ the varargs case where the explicit type is required.
Given the special type syntax in call instructions, the regex-fu used
for migration was a bit more involved in its own unique way (as every
one of these is) so here it is. Use it in conjunction with the apply.sh
script and associated find/xargs commands I've provided in rr230786 to
migrate your out of tree tests. Do let me know if any of this doesn't
cover your cases & we can iterate on a more general script/regexes to
help others with out of tree tests.
About 9 test cases couldn't be automatically migrated - half of those
were functions returning function pointers, where I just had to manually
delete the function argument types now that we didn't need an explicit
function type there. The other half were typedefs of function types used
in calls - just had to manually drop the * from those.
import fileinput
import sys
import re
pat = re.compile(r'((?:=|:|^|\s)call\s(?:[^@]*?))(\s*$|\s*(?:(?:\[\[[a-zA-Z0-9_]+\]\]|[@%](?:(")?[\\\?@a-zA-Z0-9_.]*?(?(3)"|)|{{.*}}))(?:\(|$)|undef|inttoptr|bitcast|null|asm).*$)')
addrspace_end = re.compile(r"addrspace\(\d+\)\s*\*$")
func_end = re.compile("(?:void.*|\)\s*)\*$")
def conv(match, line):
if not match or re.search(addrspace_end, match.group(1)) or not re.search(func_end, match.group(1)):
return line
return line[:match.start()] + match.group(1)[:match.group(1).rfind('*')].rstrip() + match.group(2) + line[match.end():]
for line in sys.stdin:
sys.stdout.write(conv(re.search(pat, line), line))
llvm-svn: 235145
2015-04-17 07:24:18 +08:00
%call = tail call i32 ( i8 * , . . . ) @printf ( i8 * getelementptr inbounds ( [ 11 x i8 ] , [ 11 x i8 ] * @.str , i32 0 , i32 0 ) , i8 * %ptr , double %conv , i32 %conv3 ) nounwind optsize , !dbg !27
2011-04-22 06:48:26 +08:00
ret i32 0 , !dbg !29
}
declare i32 @printf ( i8 * nocapture , . . . ) nounwind optsize
2015-11-06 06:03:56 +08:00
define i32 @printer ( i8 * %ptr , float %val , i8 zeroext %c ) nounwind optsize noinline ssp !dbg !6 {
2011-04-22 06:48:26 +08:00
entry:
2015-04-30 00:38:44 +08:00
tail call void @llvm.dbg.value ( metadata i8 * %ptr , i64 0 , metadata !14 , metadata !DIExpression ( ) ) , !dbg !30
tail call void @llvm.dbg.value ( metadata float %val , i64 0 , metadata !15 , metadata !DIExpression ( ) ) , !dbg !31
tail call void @llvm.dbg.value ( metadata i8 %c , i64 0 , metadata !16 , metadata !DIExpression ( ) ) , !dbg !32
2011-04-22 06:48:26 +08:00
%conv = fpext float %val to double , !dbg !33
%conv3 = zext i8 %c to i32 , !dbg !33
[opaque pointer type] Add textual IR support for explicit type parameter to the call instruction
See r230786 and r230794 for similar changes to gep and load
respectively.
Call is a bit different because it often doesn't have a single explicit
type - usually the type is deduced from the arguments, and just the
return type is explicit. In those cases there's no need to change the
IR.
When that's not the case, the IR usually contains the pointer type of
the first operand - but since typed pointers are going away, that
representation is insufficient so I'm just stripping the "pointerness"
of the explicit type away.
This does make the IR a bit weird - it /sort of/ reads like the type of
the first operand: "call void () %x(" but %x is actually of type "void
()*" and will eventually be just of type "ptr". But this seems not too
bad and I don't think it would benefit from repeating the type
("void (), void () * %x(" and then eventually "void (), ptr %x(") as has
been done with gep and load.
This also has a side benefit: since the explicit type is no longer a
pointer, there's no ambiguity between an explicit type and a function
that returns a function pointer. Previously this case needed an explicit
type (eg: a function returning a void() function was written as
"call void () () * @x(" rather than "call void () * @x(" because of the
ambiguity between a function returning a pointer to a void() function
and a function returning void).
No ambiguity means even function pointer return types can just be
written alone, without writing the whole function's type.
This leaves /only/ the varargs case where the explicit type is required.
Given the special type syntax in call instructions, the regex-fu used
for migration was a bit more involved in its own unique way (as every
one of these is) so here it is. Use it in conjunction with the apply.sh
script and associated find/xargs commands I've provided in rr230786 to
migrate your out of tree tests. Do let me know if any of this doesn't
cover your cases & we can iterate on a more general script/regexes to
help others with out of tree tests.
About 9 test cases couldn't be automatically migrated - half of those
were functions returning function pointers, where I just had to manually
delete the function argument types now that we didn't need an explicit
function type there. The other half were typedefs of function types used
in calls - just had to manually drop the * from those.
import fileinput
import sys
import re
pat = re.compile(r'((?:=|:|^|\s)call\s(?:[^@]*?))(\s*$|\s*(?:(?:\[\[[a-zA-Z0-9_]+\]\]|[@%](?:(")?[\\\?@a-zA-Z0-9_.]*?(?(3)"|)|{{.*}}))(?:\(|$)|undef|inttoptr|bitcast|null|asm).*$)')
addrspace_end = re.compile(r"addrspace\(\d+\)\s*\*$")
func_end = re.compile("(?:void.*|\)\s*)\*$")
def conv(match, line):
if not match or re.search(addrspace_end, match.group(1)) or not re.search(func_end, match.group(1)):
return line
return line[:match.start()] + match.group(1)[:match.group(1).rfind('*')].rstrip() + match.group(2) + line[match.end():]
for line in sys.stdin:
sys.stdout.write(conv(re.search(pat, line), line))
llvm-svn: 235145
2015-04-17 07:24:18 +08:00
%call = tail call i32 ( i8 * , . . . ) @printf ( i8 * getelementptr inbounds ( [ 11 x i8 ] , [ 11 x i8 ] * @.str , i32 0 , i32 0 ) , i8 * %ptr , double %conv , i32 %conv3 ) nounwind optsize , !dbg !33
2011-04-22 06:48:26 +08:00
ret i32 0 , !dbg !35
}
2015-11-06 06:03:56 +08:00
define i32 @main ( i32 %argc , i8 * * nocapture %argv ) nounwind optsize ssp !dbg !7 {
2011-04-22 06:48:26 +08:00
entry:
2015-04-30 00:38:44 +08:00
tail call void @llvm.dbg.value ( metadata i32 %argc , i64 0 , metadata !17 , metadata !DIExpression ( ) ) , !dbg !36
tail call void @llvm.dbg.value ( metadata i8 * * %argv , i64 0 , metadata !18 , metadata !DIExpression ( ) ) , !dbg !37
2011-04-22 06:48:26 +08:00
%conv = sitofp i32 %argc to double , !dbg !38
%add = fadd double %conv , 5.555552e+05 , !dbg !38
%conv1 = fptrunc double %add to float , !dbg !38
2015-04-30 00:38:44 +08:00
tail call void @llvm.dbg.value ( metadata float %conv1 , i64 0 , metadata !22 , metadata !DIExpression ( ) ) , !dbg !38
2015-03-14 02:20:45 +08:00
%call = tail call i32 @puts ( i8 * getelementptr inbounds ( [ 6 x i8 ] , [ 6 x i8 ] * @.str1 , i32 0 , i32 0 ) ) nounwind optsize , !dbg !39
[opaque pointer type] Add textual IR support for explicit type parameter to getelementptr instruction
One of several parallel first steps to remove the target type of pointers,
replacing them with a single opaque pointer type.
This adds an explicit type parameter to the gep instruction so that when the
first parameter becomes an opaque pointer type, the type to gep through is
still available to the instructions.
* This doesn't modify gep operators, only instructions (operators will be
handled separately)
* Textual IR changes only. Bitcode (including upgrade) and changing the
in-memory representation will be in separate changes.
* geps of vectors are transformed as:
getelementptr <4 x float*> %x, ...
->getelementptr float, <4 x float*> %x, ...
Then, once the opaque pointer type is introduced, this will ultimately look
like:
getelementptr float, <4 x ptr> %x
with the unambiguous interpretation that it is a vector of pointers to float.
* address spaces remain on the pointer, not the type:
getelementptr float addrspace(1)* %x
->getelementptr float, float addrspace(1)* %x
Then, eventually:
getelementptr float, ptr addrspace(1) %x
Importantly, the massive amount of test case churn has been automated by
same crappy python code. I had to manually update a few test cases that
wouldn't fit the script's model (r228970,r229196,r229197,r229198). The
python script just massages stdin and writes the result to stdout, I
then wrapped that in a shell script to handle replacing files, then
using the usual find+xargs to migrate all the files.
update.py:
import fileinput
import sys
import re
ibrep = re.compile(r"(^.*?[^%\w]getelementptr inbounds )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
normrep = re.compile( r"(^.*?[^%\w]getelementptr )(((?:<\d* x )?)(.*?)(| addrspace\(\d\)) *\*(|>)(?:$| *(?:%|@|null|undef|blockaddress|getelementptr|addrspacecast|bitcast|inttoptr|\[\[[a-zA-Z]|\{\{).*$))")
def conv(match, line):
if not match:
return line
line = match.groups()[0]
if len(match.groups()[5]) == 0:
line += match.groups()[2]
line += match.groups()[3]
line += ", "
line += match.groups()[1]
line += "\n"
return line
for line in sys.stdin:
if line.find("getelementptr ") == line.find("getelementptr inbounds"):
if line.find("getelementptr inbounds") != line.find("getelementptr inbounds ("):
line = conv(re.match(ibrep, line), line)
elif line.find("getelementptr ") != line.find("getelementptr ("):
line = conv(re.match(normrep, line), line)
sys.stdout.write(line)
apply.sh:
for name in "$@"
do
python3 `dirname "$0"`/update.py < "$name" > "$name.tmp" && mv "$name.tmp" "$name"
rm -f "$name.tmp"
done
The actual commands:
From llvm/src:
find test/ -name *.ll | xargs ./apply.sh
From llvm/src/tools/clang:
find test/ -name *.mm -o -name *.m -o -name *.cpp -o -name *.c | xargs -I '{}' ../../apply.sh "{}"
From llvm/src/tools/polly:
find test/ -name *.ll | xargs ./apply.sh
After that, check-all (with llvm, clang, clang-tools-extra, lld,
compiler-rt, and polly all checked out).
The extra 'rm' in the apply.sh script is due to a few files in clang's test
suite using interesting unicode stuff that my python script was throwing
exceptions on. None of those files needed to be migrated, so it seemed
sufficient to ignore those cases.
Reviewers: rafael, dexonsmith, grosser
Differential Revision: http://reviews.llvm.org/D7636
llvm-svn: 230786
2015-02-28 03:29:02 +08:00
%add.ptr = getelementptr i8 , i8 * bitcast ( i32 ( i32 , i8 * * ) * @main to i8 * ) , i32 %argc , !dbg !40
2011-04-22 06:48:26 +08:00
%add5 = add nsw i32 %argc , 97 , !dbg !40
%conv6 = trunc i32 %add5 to i8 , !dbg !40
2015-04-30 00:38:44 +08:00
tail call void @llvm.dbg.value ( metadata i8 * %add.ptr , i64 0 , metadata !58 , metadata !DIExpression ( ) ) nounwind , !dbg !41
tail call void @llvm.dbg.value ( metadata float %conv1 , i64 0 , metadata !60 , metadata !DIExpression ( ) ) nounwind , !dbg !42
tail call void @llvm.dbg.value ( metadata i8 %conv6 , i64 0 , metadata !62 , metadata !DIExpression ( ) ) nounwind , !dbg !43
2011-04-22 06:48:26 +08:00
%conv.i = fpext float %conv1 to double , !dbg !44
%conv3.i = and i32 %add5 , 255 , !dbg !44
[opaque pointer type] Add textual IR support for explicit type parameter to the call instruction
See r230786 and r230794 for similar changes to gep and load
respectively.
Call is a bit different because it often doesn't have a single explicit
type - usually the type is deduced from the arguments, and just the
return type is explicit. In those cases there's no need to change the
IR.
When that's not the case, the IR usually contains the pointer type of
the first operand - but since typed pointers are going away, that
representation is insufficient so I'm just stripping the "pointerness"
of the explicit type away.
This does make the IR a bit weird - it /sort of/ reads like the type of
the first operand: "call void () %x(" but %x is actually of type "void
()*" and will eventually be just of type "ptr". But this seems not too
bad and I don't think it would benefit from repeating the type
("void (), void () * %x(" and then eventually "void (), ptr %x(") as has
been done with gep and load.
This also has a side benefit: since the explicit type is no longer a
pointer, there's no ambiguity between an explicit type and a function
that returns a function pointer. Previously this case needed an explicit
type (eg: a function returning a void() function was written as
"call void () () * @x(" rather than "call void () * @x(" because of the
ambiguity between a function returning a pointer to a void() function
and a function returning void).
No ambiguity means even function pointer return types can just be
written alone, without writing the whole function's type.
This leaves /only/ the varargs case where the explicit type is required.
Given the special type syntax in call instructions, the regex-fu used
for migration was a bit more involved in its own unique way (as every
one of these is) so here it is. Use it in conjunction with the apply.sh
script and associated find/xargs commands I've provided in rr230786 to
migrate your out of tree tests. Do let me know if any of this doesn't
cover your cases & we can iterate on a more general script/regexes to
help others with out of tree tests.
About 9 test cases couldn't be automatically migrated - half of those
were functions returning function pointers, where I just had to manually
delete the function argument types now that we didn't need an explicit
function type there. The other half were typedefs of function types used
in calls - just had to manually drop the * from those.
import fileinput
import sys
import re
pat = re.compile(r'((?:=|:|^|\s)call\s(?:[^@]*?))(\s*$|\s*(?:(?:\[\[[a-zA-Z0-9_]+\]\]|[@%](?:(")?[\\\?@a-zA-Z0-9_.]*?(?(3)"|)|{{.*}}))(?:\(|$)|undef|inttoptr|bitcast|null|asm).*$)')
addrspace_end = re.compile(r"addrspace\(\d+\)\s*\*$")
func_end = re.compile("(?:void.*|\)\s*)\*$")
def conv(match, line):
if not match or re.search(addrspace_end, match.group(1)) or not re.search(func_end, match.group(1)):
return line
return line[:match.start()] + match.group(1)[:match.group(1).rfind('*')].rstrip() + match.group(2) + line[match.end():]
for line in sys.stdin:
sys.stdout.write(conv(re.search(pat, line), line))
llvm-svn: 235145
2015-04-17 07:24:18 +08:00
%call.i = tail call i32 ( i8 * , . . . ) @printf ( i8 * getelementptr inbounds ( [ 11 x i8 ] , [ 11 x i8 ] * @.str , i32 0 , i32 0 ) , i8 * %add.ptr , double %conv.i , i32 %conv3.i ) nounwind optsize , !dbg !44
2011-04-22 06:48:26 +08:00
%call14 = tail call i32 @printer ( i8 * %add.ptr , float %conv1 , i8 zeroext %conv6 ) optsize , !dbg !45
ret i32 0 , !dbg !46
}
declare i32 @puts ( i8 * nocapture ) nounwind optsize
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
llvm-svn: 218787
2014-10-02 02:55:02 +08:00
declare void @llvm.dbg.value ( metadata , i64 , metadata , metadata ) nounwind readnone
2011-04-22 06:48:26 +08:00
2013-03-08 08:23:31 +08:00
!llvm.dbg.cu = ! { !2 }
2013-11-23 05:49:45 +08:00
!llvm.module.flags = ! { !53 }
2011-04-22 06:48:26 +08:00
2016-04-15 23:57:41 +08:00
!0 = distinct !DISubprogram ( name: "inlineprinter" , line: 5 , isLocal: false , isDefinition: true , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !2 , scopeLine: 5 , file: !51 , scope: !1 , type: !3 , variables: !48 )
2015-04-30 00:38:44 +08:00
!1 = !DIFile ( filename: "a.c" , directory: "/private/tmp" )
2016-04-15 23:57:41 +08:00
!2 = distinct !DICompileUnit ( language: D W _ L A N G _ C 99 , producer: "clang version 3.0 (trunk 129915)" , isOptimized: true , emissionKind: F u l l D e b u g , file: !51 , enums: !52 , retainedTypes: !52 , imports: null )
2015-04-30 00:38:44 +08:00
!3 = !DISubroutineType ( types: !4 )
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
!4 = ! { !5 }
2015-04-30 00:38:44 +08:00
!5 = !DIBasicType ( tag: D W _ T A G _ b a s e _ type , name: "int" , size: 32 , align: 32 , encoding: D W _ A T E _ s i g n e d )
2016-04-15 23:57:41 +08:00
!6 = distinct !DISubprogram ( name: "printer" , line: 12 , isLocal: false , isDefinition: true , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !2 , scopeLine: 12 , file: !51 , scope: !1 , type: !3 , variables: !49 )
!7 = distinct !DISubprogram ( name: "main" , line: 18 , isLocal: false , isDefinition: true , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !2 , scopeLine: 18 , file: !51 , scope: !1 , type: !3 , variables: !50 )
2015-08-01 02:58:39 +08:00
!8 = !DILocalVariable ( name: "ptr" , line: 4 , arg: 1 , scope: !0 , file: !1 , type: !9 )
2015-04-30 00:38:44 +08:00
!9 = !DIDerivedType ( tag: D W _ T A G _ p o i n t e r _ type , size: 32 , align: 32 , scope: !2 , baseType: null )
2015-08-01 02:58:39 +08:00
!10 = !DILocalVariable ( name: "val" , line: 4 , arg: 2 , scope: !0 , file: !1 , type: !11 )
2015-04-30 00:38:44 +08:00
!11 = !DIBasicType ( tag: D W _ T A G _ b a s e _ type , name: "float" , size: 32 , align: 32 , encoding: D W _ A T E _ float )
2015-08-01 02:58:39 +08:00
!12 = !DILocalVariable ( name: "c" , line: 4 , arg: 3 , scope: !0 , file: !1 , type: !13 )
2015-04-30 00:38:44 +08:00
!13 = !DIBasicType ( tag: D W _ T A G _ b a s e _ type , name: "unsigned char" , size: 8 , align: 8 , encoding: D W _ A T E _ u n s i g n e d _ c h a r )
Verifier: Check that inlined-at locations agree
Check that the `MDLocalVariable::getInlinedAt()` in a debug info
intrinsic's variable always matches the `MDLocation::getInlinedAt()` of
its `!dbg` attachment.
The goal here is to get rid of `MDLocalVariable::getInlinedAt()`
entirely (PR22778), since it's expensive and unnecessary, but I'll let
this verifier check bake for a while (a week maybe?) first. I've
updated the testcases that had the wrong value for `inlinedAt:`.
This checks that things are sane in the IR, but currently things go out
of whack in a few places in the backend. I'll follow shortly with
assertions in the backend (with code fixes).
If you have out-of-tree testcases that just started failing, here's how
I updated these ones:
1. The verifier check gives you the basic block, function, instruction,
and relevant metadata arguments (metadata numbering doesn't
necessarily match the source file, unfortunately).
2. Look at the `@llvm.dbg.*()` instruction, and compare the
`inlinedAt:` fields of the variable argument (second `metadata`
argument) and the `!dbg` attachment.
3. Figure out based on the variable `scope:` chain and the functions in
the file whether the variable has been inlined (and into what), so
you can determine which `inlinedAt:` is actually correct. In all of
the in-tree testcases, the `!MDLocation()` was correct and the
`!MDLocalVariable()` was wrong, but YMMV.
4. Duplicate the metadata that you're going to change, and add/drop the
`inlinedAt:` field from one of them. Be careful that the other
references to the same metadata node point at the correct one.
llvm-svn: 234021
2015-04-04 00:54:30 +08:00
2015-08-01 02:58:39 +08:00
!58 = !DILocalVariable ( name: "ptr" , line: 4 , arg: 1 , scope: !0 , file: !1 , type: !9 )
!60 = !DILocalVariable ( name: "val" , line: 4 , arg: 2 , scope: !0 , file: !1 , type: !11 )
!62 = !DILocalVariable ( name: "c" , line: 4 , arg: 3 , scope: !0 , file: !1 , type: !13 )
Verifier: Check that inlined-at locations agree
Check that the `MDLocalVariable::getInlinedAt()` in a debug info
intrinsic's variable always matches the `MDLocation::getInlinedAt()` of
its `!dbg` attachment.
The goal here is to get rid of `MDLocalVariable::getInlinedAt()`
entirely (PR22778), since it's expensive and unnecessary, but I'll let
this verifier check bake for a while (a week maybe?) first. I've
updated the testcases that had the wrong value for `inlinedAt:`.
This checks that things are sane in the IR, but currently things go out
of whack in a few places in the backend. I'll follow shortly with
assertions in the backend (with code fixes).
If you have out-of-tree testcases that just started failing, here's how
I updated these ones:
1. The verifier check gives you the basic block, function, instruction,
and relevant metadata arguments (metadata numbering doesn't
necessarily match the source file, unfortunately).
2. Look at the `@llvm.dbg.*()` instruction, and compare the
`inlinedAt:` fields of the variable argument (second `metadata`
argument) and the `!dbg` attachment.
3. Figure out based on the variable `scope:` chain and the functions in
the file whether the variable has been inlined (and into what), so
you can determine which `inlinedAt:` is actually correct. In all of
the in-tree testcases, the `!MDLocation()` was correct and the
`!MDLocalVariable()` was wrong, but YMMV.
4. Duplicate the metadata that you're going to change, and add/drop the
`inlinedAt:` field from one of them. Be careful that the other
references to the same metadata node point at the correct one.
llvm-svn: 234021
2015-04-04 00:54:30 +08:00
2015-08-01 02:58:39 +08:00
!14 = !DILocalVariable ( name: "ptr" , line: 11 , arg: 1 , scope: !6 , file: !1 , type: !9 )
!15 = !DILocalVariable ( name: "val" , line: 11 , arg: 2 , scope: !6 , file: !1 , type: !11 )
!16 = !DILocalVariable ( name: "c" , line: 11 , arg: 3 , scope: !6 , file: !1 , type: !13 )
!17 = !DILocalVariable ( name: "argc" , line: 17 , arg: 1 , scope: !7 , file: !1 , type: !5 )
!18 = !DILocalVariable ( name: "argv" , line: 17 , arg: 2 , scope: !7 , file: !1 , type: !19 )
2015-04-30 00:38:44 +08:00
!19 = !DIDerivedType ( tag: D W _ T A G _ p o i n t e r _ type , size: 32 , align: 32 , scope: !2 , baseType: !20 )
!20 = !DIDerivedType ( tag: D W _ T A G _ p o i n t e r _ type , size: 32 , align: 32 , scope: !2 , baseType: !21 )
!21 = !DIBasicType ( tag: D W _ T A G _ b a s e _ type , name: "char" , size: 8 , align: 8 , encoding: D W _ A T E _ s i g n e d _ c h a r )
2015-08-01 02:58:39 +08:00
!22 = !DILocalVariable ( name: "dval" , line: 19 , scope: !23 , file: !1 , type: !11 )
2015-04-30 00:38:44 +08:00
!23 = distinct !DILexicalBlock ( line: 18 , column: 1 , file: !51 , scope: !7 )
!24 = !DILocation ( line: 4 , column: 22 , scope: !0 )
!25 = !DILocation ( line: 4 , column: 33 , scope: !0 )
!26 = !DILocation ( line: 4 , column: 52 , scope: !0 )
!27 = !DILocation ( line: 6 , column: 3 , scope: !28 )
!28 = distinct !DILexicalBlock ( line: 5 , column: 1 , file: !51 , scope: !0 )
!29 = !DILocation ( line: 7 , column: 3 , scope: !28 )
!30 = !DILocation ( line: 11 , column: 42 , scope: !6 )
!31 = !DILocation ( line: 11 , column: 53 , scope: !6 )
!32 = !DILocation ( line: 11 , column: 72 , scope: !6 )
!33 = !DILocation ( line: 13 , column: 3 , scope: !34 )
!34 = distinct !DILexicalBlock ( line: 12 , column: 1 , file: !51 , scope: !6 )
!35 = !DILocation ( line: 14 , column: 3 , scope: !34 )
!36 = !DILocation ( line: 17 , column: 15 , scope: !7 )
!37 = !DILocation ( line: 17 , column: 28 , scope: !7 )
!38 = !DILocation ( line: 19 , column: 31 , scope: !23 )
!39 = !DILocation ( line: 20 , column: 3 , scope: !23 )
!40 = !DILocation ( line: 21 , column: 3 , scope: !23 )
!41 = !DILocation ( line: 4 , column: 22 , scope: !0 , inlinedAt: !40 )
!42 = !DILocation ( line: 4 , column: 33 , scope: !0 , inlinedAt: !40 )
!43 = !DILocation ( line: 4 , column: 52 , scope: !0 , inlinedAt: !40 )
!44 = !DILocation ( line: 6 , column: 3 , scope: !28 , inlinedAt: !40 )
!45 = !DILocation ( line: 22 , column: 3 , scope: !23 )
!46 = !DILocation ( line: 23 , column: 1 , scope: !23 )
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
!48 = ! { !8 , !10 , !12 }
!49 = ! { !14 , !15 , !16 }
!50 = ! { !17 , !18 , !22 }
2015-04-30 00:38:44 +08:00
!51 = !DIFile ( filename: "a.c" , directory: "/private/tmp" )
2015-03-28 04:46:33 +08:00
!52 = ! { }
2015-03-04 01:24:31 +08:00
!53 = ! { i32 1 , !"Debug Info Version" , i32 3 }