2014-08-12 09:54:12 +02:00
; RUN: llc < %s -O2 -mtriple=aarch64-none-linux-gnu
; Bug 20598
define void @test ( ) #0 {
entry:
br label %for.body , !dbg !39
for.body: ; preds = %for.body, %entry
[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-27 20:29:02 +01:00
%arrayidx5 = getelementptr inbounds i32 , i32 * null , i64 1 , !dbg !43
2015-02-27 22:17:42 +01:00
%0 = load i32 , i32 * null , align 4 , !dbg !45 , !tbaa !46
2014-08-12 09:54:12 +02:00
%s1 = sub nsw i32 0 , %0 , !dbg !50
%n1 = sext i32 %s1 to i64 , !dbg !50
[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-27 20:29:02 +01:00
%arrayidx21 = getelementptr inbounds i32 , i32 * null , i64 3 , !dbg !51
2014-08-12 09:54:12 +02:00
%add53 = add nsw i64 %n1 , 0 , !dbg !52
%add55 = add nsw i64 %n1 , 0 , !dbg !53
%mul63 = mul nsw i64 %add53 , -20995 , !dbg !54
2015-03-03 18:24:31 +01:00
tail call void @llvm.dbg.value ( metadata i64 %mul63 , i64 0 , metadata !30 , metadata !MDExpression ( ) ) , !dbg !55
2014-08-12 09:54:12 +02:00
%mul65 = mul nsw i64 %add55 , -3196 , !dbg !56
%add67 = add nsw i64 0 , %mul65 , !dbg !57
%add80 = add i64 0 , 1024 , !dbg !58
%add81 = add i64 %add80 , %mul63 , !dbg !58
%add82 = add i64 %add81 , 0 , !dbg !58
%shr83351 = lshr i64 %add82 , 11 , !dbg !58
%conv84 = trunc i64 %shr83351 to i32 , !dbg !58
store i32 %conv84 , i32 * %arrayidx21 , align 4 , !dbg !58 , !tbaa !46
%add86 = add i64 0 , 1024 , !dbg !59
%add87 = add i64 %add86 , 0 , !dbg !59
%add88 = add i64 %add87 , %add67 , !dbg !59
%shr89352 = lshr i64 %add88 , 11 , !dbg !59
%n2 = trunc i64 %shr89352 to i32 , !dbg !59
store i32 %n2 , i32 * %arrayidx5 , align 4 , !dbg !59 , !tbaa !46
br label %for.body , !dbg !39
}
; Function Attrs: nounwind readnone
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-01 20:55:02 +02:00
declare void @llvm.dbg.value ( metadata , i64 , metadata , metadata ) #1
2014-08-12 09:54:12 +02:00
attributes #0 = { nounwind "less-precise-fpmad" = "false" "no-frame-pointer-elim" = "true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math" = "false" "no-nans-fp-math" = "false" "stack-protector-buffer-size" = "8" "unsafe-fp-math" = "false" "use-soft-float" = "false" }
attributes #1 = { nounwind readnone }
!llvm.dbg.cu = ! { !0 }
!llvm.module.flags = ! { !36 , !37 }
!llvm.ident = ! { !38 }
2015-03-03 18:24:31 +01:00
!0 = !MDCompileUnit ( language: D W _ L A N G _ C 99 , producer: "clang version 3.6.0 " , isOptimized: true , emissionKind: 1 , file: !1 , enums: !2 , retainedTypes: !2 , subprograms: !3 , globals: !2 , imports: !2 )
!1 = !MDFile ( filename: "test.c" , directory: "" )
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-15 20:07:53 +01:00
!2 = ! { }
!3 = ! { !4 }
2015-03-16 22:10:12 +01:00
!4 = !MDSubprogram ( name: "" , line: 140 , 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 , scopeLine: 141 , file: !1 , scope: !1 , type: !6 , function: void ( ) * @test , variables: !12 )
2015-03-03 18:24:31 +01:00
!6 = !MDSubroutineType ( types: !7 )
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-15 20:07:53 +01:00
!7 = ! { null , !8 }
2015-03-03 18:24:31 +01:00
!8 = !MDDerivedType ( tag: D W _ T A G _ p o i n t e r _ type , size: 64 , align: 64 , baseType: !9 )
2015-03-16 22:10:12 +01:00
!9 = !MDDerivedType ( tag: D W _ T A G _ t y p e d e f , line: 30 , file: !1 , baseType: !11 )
2015-03-03 18:24:31 +01:00
!11 = !MDBasicType ( 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 )
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-15 20:07:53 +01:00
!12 = ! { !13 , !14 , !18 , !19 , !20 , !21 , !22 , !23 , !24 , !25 , !26 , !27 , !28 , !29 , !30 , !31 , !32 , !33 , !34 , !35 }
2015-03-16 22:10:12 +01:00
!13 = !MDLocalVariable ( tag: D W _ T A G _ a r g _ v a r i a b l e , name: "" , line: 140 , arg: 1 , scope: !4 , file: !1 , type: !8 )
!14 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 142 , scope: !4 , file: !1 , type: !15 )
!15 = !MDDerivedType ( tag: D W _ T A G _ t y p e d e f , line: 183 , file: !1 , baseType: !17 )
2015-03-03 18:24:31 +01:00
!17 = !MDBasicType ( tag: D W _ T A G _ b a s e _ type , size: 64 , align: 64 , encoding: D W _ A T E _ s i g n e d )
2015-03-16 22:10:12 +01:00
!18 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 142 , scope: !4 , file: !1 , type: !15 )
!19 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 142 , scope: !4 , file: !1 , type: !15 )
!20 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 142 , scope: !4 , file: !1 , type: !15 )
!21 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 142 , scope: !4 , file: !1 , type: !15 )
!22 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 142 , scope: !4 , file: !1 , type: !15 )
!23 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 142 , scope: !4 , file: !1 , type: !15 )
!24 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 142 , scope: !4 , file: !1 , type: !15 )
!25 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 143 , scope: !4 , file: !1 , type: !15 )
!26 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 143 , scope: !4 , file: !1 , type: !15 )
!27 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 143 , scope: !4 , file: !1 , type: !15 )
!28 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 143 , scope: !4 , file: !1 , type: !15 )
!29 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 144 , scope: !4 , file: !1 , type: !15 )
!30 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 144 , scope: !4 , file: !1 , type: !15 )
!31 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 144 , scope: !4 , file: !1 , type: !15 )
!32 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 144 , scope: !4 , file: !1 , type: !15 )
!33 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 144 , scope: !4 , file: !1 , type: !15 )
!34 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 145 , scope: !4 , file: !1 , type: !8 )
!35 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "" , line: 146 , scope: !4 , file: !1 , type: !11 )
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-15 20:07:53 +01:00
!36 = ! { i32 2 , !"Dwarf Version" , i32 4 }
2015-03-03 18:24:31 +01:00
!37 = ! { i32 2 , !"Debug Info Version" , i32 3 }
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-15 20:07:53 +01:00
!38 = ! { !"clang version 3.6.0 " }
2015-01-14 23:27:36 +01:00
!39 = !MDLocation ( line: 154 , column: 8 , scope: !40 )
2015-03-03 18:24:31 +01:00
!40 = distinct !MDLexicalBlock ( line: 154 , column: 8 , file: !1 , scope: !41 )
!41 = distinct !MDLexicalBlock ( line: 154 , column: 8 , file: !1 , scope: !42 )
!42 = distinct !MDLexicalBlock ( line: 154 , column: 3 , file: !1 , scope: !4 )
2015-01-14 23:27:36 +01:00
!43 = !MDLocation ( line: 157 , column: 5 , scope: !44 )
2015-03-03 18:24:31 +01:00
!44 = distinct !MDLexicalBlock ( line: 154 , column: 42 , file: !1 , scope: !42 )
2015-01-14 23:27:36 +01:00
!45 = !MDLocation ( line: 159 , column: 5 , scope: !44 )
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-15 20:07:53 +01:00
!46 = ! { !47 , !47 , i64 0 }
!47 = ! { !"int" , !48 , i64 0 }
!48 = ! { !"omnipotent char" , !49 , i64 0 }
!49 = ! { !"Simple C/C++ TBAA" }
2015-01-14 23:27:36 +01:00
!50 = !MDLocation ( line: 160 , column: 5 , scope: !44 )
!51 = !MDLocation ( line: 161 , column: 5 , scope: !44 )
!52 = !MDLocation ( line: 188 , column: 5 , scope: !44 )
!53 = !MDLocation ( line: 190 , column: 5 , scope: !44 )
!54 = !MDLocation ( line: 198 , column: 5 , scope: !44 )
!55 = !MDLocation ( line: 144 , column: 13 , scope: !4 )
!56 = !MDLocation ( line: 200 , column: 5 , scope: !44 )
!57 = !MDLocation ( line: 203 , column: 5 , scope: !44 )
!58 = !MDLocation ( line: 207 , column: 5 , scope: !44 )
!59 = !MDLocation ( line: 208 , column: 5 , scope: !44 )