2012-07-28 04:19:49 +08:00
|
|
|
; RUN: llc < %s -regalloc=fast -optimize-regalloc=0 -verify-machineinstrs -mtriple=x86_64-apple-darwin10
|
2010-03-16 09:54:20 +08:00
|
|
|
; <rdar://problem/7755473>
|
2012-05-15 05:10:25 +08:00
|
|
|
; PR12821
|
2010-03-16 09:54:20 +08:00
|
|
|
|
|
|
|
%0 = type { i32, i8*, i8*, %1*, i8*, i64, i64, i32, i32, i32, i32, [1024 x i8] }
|
|
|
|
%1 = type { i8*, i32, i32, i16, i16, %2, i32, i8*, i32 (i8*)*, i32 (i8*, i8*, i32)*, i64 (i8*, i64, i32)*, i32 (i8*, i8*, i32)*, %2, %3*, i32, [3 x i8], [1 x i8], %2, i32, i64 }
|
|
|
|
%2 = type { i8*, i32 }
|
|
|
|
%3 = type opaque
|
|
|
|
|
|
|
|
declare fastcc i32 @func(%0*, i32, i32) nounwind ssp
|
|
|
|
|
|
|
|
define fastcc void @func2(%0* %arg, i32 %arg1) nounwind ssp {
|
|
|
|
bb:
|
|
|
|
br label %.exit3
|
|
|
|
|
|
|
|
.exit3: ; preds = %.exit3, %bb
|
|
|
|
switch i32 undef, label %.exit3 [
|
|
|
|
i32 -1, label %.loopexit
|
|
|
|
i32 37, label %bb2
|
|
|
|
]
|
|
|
|
|
|
|
|
bb2: ; preds = %bb5, %bb3, %.exit3
|
|
|
|
br i1 undef, label %bb3, label %bb5
|
|
|
|
|
|
|
|
bb3: ; preds = %bb2
|
|
|
|
switch i32 undef, label %infloop [
|
|
|
|
i32 125, label %.loopexit
|
|
|
|
i32 -1, label %bb4
|
|
|
|
i32 37, label %bb2
|
|
|
|
]
|
|
|
|
|
|
|
|
bb4: ; preds = %bb3
|
|
|
|
%tmp = add nsw i32 undef, 1 ; <i32> [#uses=1]
|
|
|
|
br label %.loopexit
|
|
|
|
|
|
|
|
bb5: ; preds = %bb2
|
|
|
|
switch i32 undef, label %infloop1 [
|
|
|
|
i32 -1, label %.loopexit
|
|
|
|
i32 37, label %bb2
|
|
|
|
]
|
|
|
|
|
|
|
|
.loopexit: ; preds = %bb5, %bb4, %bb3, %.exit3
|
|
|
|
%.04 = phi i32 [ %tmp, %bb4 ], [ undef, %bb3 ], [ undef, %.exit3 ], [ undef, %bb5 ] ; <i32> [#uses=2]
|
|
|
|
br i1 undef, label %bb8, label %bb6
|
|
|
|
|
|
|
|
bb6: ; preds = %.loopexit
|
|
|
|
%tmp7 = tail call fastcc i32 @func(%0* %arg, i32 %.04, i32 undef) nounwind ssp ; <i32> [#uses=0]
|
|
|
|
ret void
|
|
|
|
|
|
|
|
bb8: ; preds = %.loopexit
|
|
|
|
%tmp9 = sext i32 %.04 to i64 ; <i64> [#uses=1]
|
[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
|
|
|
%tmp10 = getelementptr inbounds %0, %0* %arg, i64 0, i32 11, i64 %tmp9 ; <i8*> [#uses=1]
|
2010-03-16 09:54:20 +08:00
|
|
|
store i8 0, i8* %tmp10, align 1
|
|
|
|
ret void
|
|
|
|
|
|
|
|
infloop: ; preds = %infloop, %bb3
|
|
|
|
br label %infloop
|
|
|
|
|
|
|
|
infloop1: ; preds = %infloop1, %bb5
|
|
|
|
br label %infloop1
|
|
|
|
}
|
2012-05-15 05:10:25 +08:00
|
|
|
|
|
|
|
|
2017-12-07 18:40:31 +08:00
|
|
|
; RAFast would forget to add a super-register implicit-def when rewriting:
|
|
|
|
; %10:sub_32bit<def,read-undef> = COPY killed %R9D
|
2012-05-15 05:10:25 +08:00
|
|
|
; This trips up the machine code verifier.
|
|
|
|
define void @autogen_SD24657(i8*, i32*, i64*, i32, i64, i8) {
|
|
|
|
BB:
|
|
|
|
%A4 = alloca <16 x i16>
|
|
|
|
%A3 = alloca double
|
|
|
|
%A2 = alloca <2 x i8>
|
|
|
|
%A1 = alloca i1
|
|
|
|
%A = alloca i32
|
2015-02-28 05:17:42 +08:00
|
|
|
%L = load i8, i8* %0
|
2012-05-15 05:10:25 +08:00
|
|
|
store i8 -37, i8* %0
|
|
|
|
%E = extractelement <4 x i64> zeroinitializer, i32 2
|
|
|
|
%Shuff = shufflevector <4 x i64> zeroinitializer, <4 x i64> zeroinitializer, <4 x i32> <i32 5, i32 7, i32 1, i32 3>
|
|
|
|
%I = insertelement <2 x i8> <i8 -1, i8 -1>, i8 %5, i32 1
|
|
|
|
%B = fadd float 0x45CDF5B1C0000000, 0x45CDF5B1C0000000
|
|
|
|
%FC = uitofp i32 275048 to double
|
|
|
|
%Sl = select i1 true, <2 x i8> %I, <2 x i8> <i8 -1, i8 -1>
|
|
|
|
%Cmp = icmp slt i64 0, %E
|
|
|
|
br label %CF
|
|
|
|
|
|
|
|
CF: ; preds = %BB
|
|
|
|
store i8 %5, i8* %0
|
|
|
|
store <2 x i8> %I, <2 x i8>* %A2
|
|
|
|
store i8 %5, i8* %0
|
|
|
|
store i8 %5, i8* %0
|
|
|
|
store i8 %5, i8* %0
|
|
|
|
ret void
|
|
|
|
}
|