2013-05-07 00:17:29 +08:00
|
|
|
; Test the handling of base + index + displacement addresses for large frames,
|
|
|
|
; in cases where both 12-bit and 20-bit displacements are allowed.
|
2013-10-31 20:14:17 +08:00
|
|
|
; The tests here assume z10 register pressure, without the high words
|
|
|
|
; being available.
|
2013-05-07 00:17:29 +08:00
|
|
|
;
|
2013-10-31 20:14:17 +08:00
|
|
|
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 | \
|
|
|
|
; RUN: FileCheck -check-prefix=CHECK-NOFP %s
|
|
|
|
; RUN: llc < %s -mtriple=s390x-linux-gnu -mcpu=z10 -disable-fp-elim | \
|
|
|
|
; RUN: FileCheck -check-prefix=CHECK-FP %s
|
2013-05-07 00:17:29 +08:00
|
|
|
|
|
|
|
; This file tests what happens when a displacement is converted from
|
|
|
|
; being relative to the start of a frame object to being relative to
|
|
|
|
; the frame itself. In some cases the test is only possible if two
|
|
|
|
; objects are allocated.
|
|
|
|
;
|
|
|
|
; Rather than rely on a particular order for those objects, the tests
|
|
|
|
; instead allocate two objects of the same size and apply the test to
|
|
|
|
; both of them. For consistency, all tests follow this model, even if
|
|
|
|
; one object would actually be enough.
|
|
|
|
|
|
|
|
; First check the highest offset that is in range of the 12-bit form.
|
|
|
|
;
|
2013-07-05 21:11:52 +08:00
|
|
|
; The last in-range doubleword offset is 4088. Since the frame has two
|
|
|
|
; emergency spill slots at 160(%r15), the amount that we need to allocate
|
|
|
|
; in order to put another object at offset 4088 is 4088 - 176 = 3912 bytes.
|
2013-05-07 00:17:29 +08:00
|
|
|
define void @f1(i8 %byte) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-NOFP-LABEL: f1:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-NOFP: stc %r2, 4095(%r15)
|
|
|
|
; CHECK-NOFP: br %r14
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-FP-LABEL: f1:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-FP: stc %r2, 4095(%r11)
|
|
|
|
; CHECK-FP: br %r14
|
2013-07-05 21:11:52 +08:00
|
|
|
%region1 = alloca [3912 x i8], align 8
|
|
|
|
%region2 = alloca [3912 x i8], align 8
|
[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
|
|
|
%ptr1 = getelementptr inbounds [3912 x i8], [3912 x i8]* %region1, i64 0, i64 7
|
|
|
|
%ptr2 = getelementptr inbounds [3912 x i8], [3912 x i8]* %region2, i64 0, i64 7
|
2013-05-07 00:17:29 +08:00
|
|
|
store volatile i8 %byte, i8 *%ptr1
|
|
|
|
store volatile i8 %byte, i8 *%ptr2
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test the first offset that is out-of-range of the 12-bit form.
|
|
|
|
define void @f2(i8 %byte) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-NOFP-LABEL: f2:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-NOFP: stcy %r2, 4096(%r15)
|
|
|
|
; CHECK-NOFP: br %r14
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-FP-LABEL: f2:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-FP: stcy %r2, 4096(%r11)
|
|
|
|
; CHECK-FP: br %r14
|
2013-07-05 21:11:52 +08:00
|
|
|
%region1 = alloca [3912 x i8], align 8
|
|
|
|
%region2 = alloca [3912 x i8], align 8
|
[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
|
|
|
%ptr1 = getelementptr inbounds [3912 x i8], [3912 x i8]* %region1, i64 0, i64 8
|
|
|
|
%ptr2 = getelementptr inbounds [3912 x i8], [3912 x i8]* %region2, i64 0, i64 8
|
2013-05-07 00:17:29 +08:00
|
|
|
store volatile i8 %byte, i8 *%ptr1
|
|
|
|
store volatile i8 %byte, i8 *%ptr2
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test the last offset that is in range of the 20-bit form.
|
|
|
|
;
|
|
|
|
; The last in-range doubleword offset is 524280, so by the same reasoning
|
2013-07-05 21:11:52 +08:00
|
|
|
; as above, we need to allocate objects of 524280 - 176 = 524104 bytes.
|
2013-05-07 00:17:29 +08:00
|
|
|
define void @f3(i8 %byte) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-NOFP-LABEL: f3:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-NOFP: stcy %r2, 524287(%r15)
|
|
|
|
; CHECK-NOFP: br %r14
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-FP-LABEL: f3:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-FP: stcy %r2, 524287(%r11)
|
|
|
|
; CHECK-FP: br %r14
|
2013-07-05 21:11:52 +08:00
|
|
|
%region1 = alloca [524104 x i8], align 8
|
|
|
|
%region2 = alloca [524104 x i8], align 8
|
[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
|
|
|
%ptr1 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region1, i64 0, i64 7
|
|
|
|
%ptr2 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region2, i64 0, i64 7
|
2013-05-07 00:17:29 +08:00
|
|
|
store volatile i8 %byte, i8 *%ptr1
|
|
|
|
store volatile i8 %byte, i8 *%ptr2
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test the first out-of-range offset. We can't use an index register here,
|
|
|
|
; and the offset is also out of LAY's range, so expect a constant load
|
|
|
|
; followed by an addition.
|
|
|
|
define void @f4(i8 %byte) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-NOFP-LABEL: f4:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-NOFP: llilh %r1, 8
|
|
|
|
; CHECK-NOFP: stc %r2, 0(%r1,%r15)
|
|
|
|
; CHECK-NOFP: br %r14
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-FP-LABEL: f4:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-FP: llilh %r1, 8
|
|
|
|
; CHECK-FP: stc %r2, 0(%r1,%r11)
|
|
|
|
; CHECK-FP: br %r14
|
2013-07-05 21:11:52 +08:00
|
|
|
%region1 = alloca [524104 x i8], align 8
|
|
|
|
%region2 = alloca [524104 x i8], align 8
|
[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
|
|
|
%ptr1 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region1, i64 0, i64 8
|
|
|
|
%ptr2 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region2, i64 0, i64 8
|
2013-05-07 00:17:29 +08:00
|
|
|
store volatile i8 %byte, i8 *%ptr1
|
|
|
|
store volatile i8 %byte, i8 *%ptr2
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Add 4095 to the previous offset, to test the other end of the STC range.
|
|
|
|
; The instruction will actually be STCY before frame lowering.
|
|
|
|
define void @f5(i8 %byte) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-NOFP-LABEL: f5:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-NOFP: llilh %r1, 8
|
|
|
|
; CHECK-NOFP: stc %r2, 4095(%r1,%r15)
|
|
|
|
; CHECK-NOFP: br %r14
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-FP-LABEL: f5:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-FP: llilh %r1, 8
|
|
|
|
; CHECK-FP: stc %r2, 4095(%r1,%r11)
|
|
|
|
; CHECK-FP: br %r14
|
2013-07-05 21:11:52 +08:00
|
|
|
%region1 = alloca [524104 x i8], align 8
|
|
|
|
%region2 = alloca [524104 x i8], align 8
|
[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
|
|
|
%ptr1 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region1, i64 0, i64 4103
|
|
|
|
%ptr2 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region2, i64 0, i64 4103
|
2013-05-07 00:17:29 +08:00
|
|
|
store volatile i8 %byte, i8 *%ptr1
|
|
|
|
store volatile i8 %byte, i8 *%ptr2
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Test the next offset after that, which uses STCY instead of STC.
|
|
|
|
define void @f6(i8 %byte) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-NOFP-LABEL: f6:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-NOFP: llilh %r1, 8
|
|
|
|
; CHECK-NOFP: stcy %r2, 4096(%r1,%r15)
|
|
|
|
; CHECK-NOFP: br %r14
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-FP-LABEL: f6:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-FP: llilh %r1, 8
|
|
|
|
; CHECK-FP: stcy %r2, 4096(%r1,%r11)
|
|
|
|
; CHECK-FP: br %r14
|
2013-07-05 21:11:52 +08:00
|
|
|
%region1 = alloca [524104 x i8], align 8
|
|
|
|
%region2 = alloca [524104 x i8], align 8
|
[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
|
|
|
%ptr1 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region1, i64 0, i64 4104
|
|
|
|
%ptr2 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region2, i64 0, i64 4104
|
2013-05-07 00:17:29 +08:00
|
|
|
store volatile i8 %byte, i8 *%ptr1
|
|
|
|
store volatile i8 %byte, i8 *%ptr2
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Now try an offset of 524287 from the start of the object, with the
|
|
|
|
; object being at offset 1048576 (1 << 20). The backend prefers to create
|
|
|
|
; anchors 0x10000 bytes apart, so that the high part can be loaded using
|
|
|
|
; LLILH while still using STC in more cases than 0x40000 anchors would.
|
|
|
|
define void @f7(i8 %byte) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-NOFP-LABEL: f7:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-NOFP: llilh %r1, 23
|
|
|
|
; CHECK-NOFP: stcy %r2, 65535(%r1,%r15)
|
|
|
|
; CHECK-NOFP: br %r14
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-FP-LABEL: f7:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-FP: llilh %r1, 23
|
|
|
|
; CHECK-FP: stcy %r2, 65535(%r1,%r11)
|
|
|
|
; CHECK-FP: br %r14
|
2013-07-05 21:11:52 +08:00
|
|
|
%region1 = alloca [1048400 x i8], align 8
|
|
|
|
%region2 = alloca [1048400 x i8], align 8
|
[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
|
|
|
%ptr1 = getelementptr inbounds [1048400 x i8], [1048400 x i8]* %region1, i64 0, i64 524287
|
|
|
|
%ptr2 = getelementptr inbounds [1048400 x i8], [1048400 x i8]* %region2, i64 0, i64 524287
|
2013-05-07 00:17:29 +08:00
|
|
|
store volatile i8 %byte, i8 *%ptr1
|
|
|
|
store volatile i8 %byte, i8 *%ptr2
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Keep the object-relative offset the same but bump the size of the
|
|
|
|
; objects by one doubleword.
|
|
|
|
define void @f8(i8 %byte) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-NOFP-LABEL: f8:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-NOFP: llilh %r1, 24
|
|
|
|
; CHECK-NOFP: stc %r2, 7(%r1,%r15)
|
|
|
|
; CHECK-NOFP: br %r14
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-FP-LABEL: f8:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-FP: llilh %r1, 24
|
|
|
|
; CHECK-FP: stc %r2, 7(%r1,%r11)
|
|
|
|
; CHECK-FP: br %r14
|
2013-07-05 21:11:52 +08:00
|
|
|
%region1 = alloca [1048408 x i8], align 8
|
|
|
|
%region2 = alloca [1048408 x i8], align 8
|
[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
|
|
|
%ptr1 = getelementptr inbounds [1048408 x i8], [1048408 x i8]* %region1, i64 0, i64 524287
|
|
|
|
%ptr2 = getelementptr inbounds [1048408 x i8], [1048408 x i8]* %region2, i64 0, i64 524287
|
2013-05-07 00:17:29 +08:00
|
|
|
store volatile i8 %byte, i8 *%ptr1
|
|
|
|
store volatile i8 %byte, i8 *%ptr2
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Check a case where the original displacement is out of range. The backend
|
|
|
|
; should force separate address logic from the outset. We don't yet do any
|
|
|
|
; kind of anchor optimization, so there should be no offset on the STC itself.
|
|
|
|
;
|
|
|
|
; Before frame lowering this is an LA followed by the AGFI seen below.
|
|
|
|
; The LA then gets lowered into the LLILH/LA form. The exact sequence
|
|
|
|
; isn't that important though.
|
|
|
|
define void @f9(i8 %byte) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-NOFP-LABEL: f9:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-NOFP: llilh [[R1:%r[1-5]]], 16
|
|
|
|
; CHECK-NOFP: la [[R2:%r[1-5]]], 8([[R1]],%r15)
|
|
|
|
; CHECK-NOFP: agfi [[R2]], 524288
|
|
|
|
; CHECK-NOFP: stc %r2, 0([[R2]])
|
|
|
|
; CHECK-NOFP: br %r14
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-FP-LABEL: f9:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-FP: llilh [[R1:%r[1-5]]], 16
|
|
|
|
; CHECK-FP: la [[R2:%r[1-5]]], 8([[R1]],%r11)
|
|
|
|
; CHECK-FP: agfi [[R2]], 524288
|
|
|
|
; CHECK-FP: stc %r2, 0([[R2]])
|
|
|
|
; CHECK-FP: br %r14
|
2013-07-05 21:11:52 +08:00
|
|
|
%region1 = alloca [1048408 x i8], align 8
|
|
|
|
%region2 = alloca [1048408 x i8], align 8
|
[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
|
|
|
%ptr1 = getelementptr inbounds [1048408 x i8], [1048408 x i8]* %region1, i64 0, i64 524288
|
|
|
|
%ptr2 = getelementptr inbounds [1048408 x i8], [1048408 x i8]* %region2, i64 0, i64 524288
|
2013-05-07 00:17:29 +08:00
|
|
|
store volatile i8 %byte, i8 *%ptr1
|
|
|
|
store volatile i8 %byte, i8 *%ptr2
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-05 21:11:52 +08:00
|
|
|
; Repeat f4 in a case that needs the emergency spill slots (because all
|
2013-05-07 00:17:29 +08:00
|
|
|
; call-clobbered registers are live and no call-saved ones have been
|
|
|
|
; allocated).
|
|
|
|
define void @f10(i32 *%vptr, i8 %byte) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-NOFP-LABEL: f10:
|
2013-07-05 21:11:52 +08:00
|
|
|
; CHECK-NOFP: stg [[REGISTER:%r[1-9][0-4]?]], [[OFFSET:160|168]](%r15)
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-NOFP: llilh [[REGISTER]], 8
|
|
|
|
; CHECK-NOFP: stc %r3, 0([[REGISTER]],%r15)
|
2013-07-05 21:11:52 +08:00
|
|
|
; CHECK-NOFP: lg [[REGISTER]], [[OFFSET]](%r15)
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-NOFP: br %r14
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-FP-LABEL: f10:
|
2013-07-05 21:11:52 +08:00
|
|
|
; CHECK-FP: stg [[REGISTER:%r[1-9][0-4]?]], [[OFFSET:160|168]](%r11)
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-FP: llilh [[REGISTER]], 8
|
|
|
|
; CHECK-FP: stc %r3, 0([[REGISTER]],%r11)
|
2013-07-05 21:11:52 +08:00
|
|
|
; CHECK-FP: lg [[REGISTER]], [[OFFSET]](%r11)
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-FP: br %r14
|
2015-02-28 05:17:42 +08:00
|
|
|
%i0 = load volatile i32 , i32 *%vptr
|
|
|
|
%i1 = load volatile i32 , i32 *%vptr
|
|
|
|
%i4 = load volatile i32 , i32 *%vptr
|
|
|
|
%i5 = load volatile i32 , i32 *%vptr
|
2013-07-05 21:11:52 +08:00
|
|
|
%region1 = alloca [524104 x i8], align 8
|
|
|
|
%region2 = alloca [524104 x i8], align 8
|
[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
|
|
|
%ptr1 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region1, i64 0, i64 8
|
|
|
|
%ptr2 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region2, i64 0, i64 8
|
2013-05-07 00:17:29 +08:00
|
|
|
store volatile i8 %byte, i8 *%ptr1
|
|
|
|
store volatile i8 %byte, i8 *%ptr2
|
|
|
|
store volatile i32 %i0, i32 *%vptr
|
|
|
|
store volatile i32 %i1, i32 *%vptr
|
|
|
|
store volatile i32 %i4, i32 *%vptr
|
|
|
|
store volatile i32 %i5, i32 *%vptr
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
2013-07-05 21:11:52 +08:00
|
|
|
; And again with maximum register pressure. The only spill slots that the
|
|
|
|
; NOFP case needs are the emergency ones, so the offsets are the same as for f4.
|
2013-05-07 00:17:29 +08:00
|
|
|
; However, the FP case uses %r11 as the frame pointer and must therefore
|
|
|
|
; spill a second register. This leads to an extra displacement of 8.
|
|
|
|
define void @f11(i32 *%vptr, i8 %byte) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-NOFP-LABEL: f11:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-NOFP: stmg %r6, %r15,
|
2013-07-05 21:11:52 +08:00
|
|
|
; CHECK-NOFP: stg [[REGISTER:%r[1-9][0-4]?]], [[OFFSET:160|168]](%r15)
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-NOFP: llilh [[REGISTER]], 8
|
|
|
|
; CHECK-NOFP: stc %r3, 0([[REGISTER]],%r15)
|
2013-07-05 21:11:52 +08:00
|
|
|
; CHECK-NOFP: lg [[REGISTER]], [[OFFSET]](%r15)
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-NOFP: lmg %r6, %r15,
|
|
|
|
; CHECK-NOFP: br %r14
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-FP-LABEL: f11:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-FP: stmg %r6, %r15,
|
2013-07-05 21:11:52 +08:00
|
|
|
; CHECK-FP: stg [[REGISTER:%r[1-9][0-4]?]], [[OFFSET:160|168]](%r11)
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-FP: llilh [[REGISTER]], 8
|
|
|
|
; CHECK-FP: stc %r3, 8([[REGISTER]],%r11)
|
2013-07-05 21:11:52 +08:00
|
|
|
; CHECK-FP: lg [[REGISTER]], [[OFFSET]](%r11)
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-FP: lmg %r6, %r15,
|
|
|
|
; CHECK-FP: br %r14
|
2015-02-28 05:17:42 +08:00
|
|
|
%i0 = load volatile i32 , i32 *%vptr
|
|
|
|
%i1 = load volatile i32 , i32 *%vptr
|
|
|
|
%i4 = load volatile i32 , i32 *%vptr
|
|
|
|
%i5 = load volatile i32 , i32 *%vptr
|
|
|
|
%i6 = load volatile i32 , i32 *%vptr
|
|
|
|
%i7 = load volatile i32 , i32 *%vptr
|
|
|
|
%i8 = load volatile i32 , i32 *%vptr
|
|
|
|
%i9 = load volatile i32 , i32 *%vptr
|
|
|
|
%i10 = load volatile i32 , i32 *%vptr
|
|
|
|
%i11 = load volatile i32 , i32 *%vptr
|
|
|
|
%i12 = load volatile i32 , i32 *%vptr
|
|
|
|
%i13 = load volatile i32 , i32 *%vptr
|
|
|
|
%i14 = load volatile i32 , i32 *%vptr
|
2013-07-05 21:11:52 +08:00
|
|
|
%region1 = alloca [524104 x i8], align 8
|
|
|
|
%region2 = alloca [524104 x i8], align 8
|
[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
|
|
|
%ptr1 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region1, i64 0, i64 8
|
|
|
|
%ptr2 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region2, i64 0, i64 8
|
2013-05-07 00:17:29 +08:00
|
|
|
store volatile i8 %byte, i8 *%ptr1
|
|
|
|
store volatile i8 %byte, i8 *%ptr2
|
|
|
|
store volatile i32 %i0, i32 *%vptr
|
|
|
|
store volatile i32 %i1, i32 *%vptr
|
|
|
|
store volatile i32 %i4, i32 *%vptr
|
|
|
|
store volatile i32 %i5, i32 *%vptr
|
|
|
|
store volatile i32 %i6, i32 *%vptr
|
|
|
|
store volatile i32 %i7, i32 *%vptr
|
|
|
|
store volatile i32 %i8, i32 *%vptr
|
|
|
|
store volatile i32 %i9, i32 *%vptr
|
|
|
|
store volatile i32 %i10, i32 *%vptr
|
|
|
|
store volatile i32 %i11, i32 *%vptr
|
|
|
|
store volatile i32 %i12, i32 *%vptr
|
|
|
|
store volatile i32 %i13, i32 *%vptr
|
|
|
|
store volatile i32 %i14, i32 *%vptr
|
|
|
|
ret void
|
|
|
|
}
|
|
|
|
|
|
|
|
; Repeat f4 in a case where the index register is already occupied.
|
|
|
|
define void @f12(i8 %byte, i64 %index) {
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-NOFP-LABEL: f12:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-NOFP: llilh %r1, 8
|
|
|
|
; CHECK-NOFP: agr %r1, %r15
|
|
|
|
; CHECK-NOFP: stc %r2, 0(%r3,%r1)
|
|
|
|
; CHECK-NOFP: br %r14
|
|
|
|
;
|
2013-07-14 14:24:09 +08:00
|
|
|
; CHECK-FP-LABEL: f12:
|
2013-05-07 00:17:29 +08:00
|
|
|
; CHECK-FP: llilh %r1, 8
|
|
|
|
; CHECK-FP: agr %r1, %r11
|
|
|
|
; CHECK-FP: stc %r2, 0(%r3,%r1)
|
|
|
|
; CHECK-FP: br %r14
|
2013-07-05 21:11:52 +08:00
|
|
|
%region1 = alloca [524104 x i8], align 8
|
|
|
|
%region2 = alloca [524104 x i8], align 8
|
2013-05-07 00:17:29 +08:00
|
|
|
%index1 = add i64 %index, 8
|
[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
|
|
|
%ptr1 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region1, i64 0, i64 %index1
|
|
|
|
%ptr2 = getelementptr inbounds [524104 x i8], [524104 x i8]* %region2, i64 0, i64 %index1
|
2013-05-07 00:17:29 +08:00
|
|
|
store volatile i8 %byte, i8 *%ptr1
|
|
|
|
store volatile i8 %byte, i8 *%ptr2
|
|
|
|
ret void
|
|
|
|
}
|