1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
llvm-mirror/test/Transforms/SCCP/2006-10-23-IPSCCP-Crash.ll

104 lines
3.0 KiB
LLVM
Raw Normal View History

; RUN: opt < %s -sccp -disable-output
; END.
target datalayout = "E-p:32:32"
2006-10-23 20:54:35 +02:00
target triple = "powerpc-apple-darwin8.7.0"
%struct.pat_list = type { i32, %struct.pat_list* }
@JUMP = external global i32 ; <i32*> [#uses=1]
@old_D_pat = external global [16 x i8] ; <[16 x i8]*> [#uses=0]
2006-10-23 20:54:35 +02:00
define void @asearch1(i32 %D) {
2006-10-23 20:54:35 +02:00
entry:
%tmp80 = icmp ult i32 0, %D ; <i1> [#uses=1]
br i1 %tmp80, label %bb647.preheader, label %cond_true81.preheader
cond_true81.preheader: ; preds = %entry
ret void
bb647.preheader: ; preds = %entry
%tmp3.i = call i32 @read( ) ; <i32> [#uses=1]
%tmp6.i = add i32 %tmp3.i, 0 ; <i32> [#uses=1]
%tmp653 = icmp sgt i32 %tmp6.i, 0 ; <i1> [#uses=1]
br i1 %tmp653, label %cond_true654, label %UnifiedReturnBlock
cond_true612: ; preds = %cond_true654
ret void
cond_next624: ; preds = %cond_true654
ret void
cond_true654: ; preds = %bb647.preheader
br i1 undef, label %cond_true612, label %cond_next624
UnifiedReturnBlock: ; preds = %bb647.preheader
ret void
2006-10-23 20:54:35 +02:00
}
define void @bitap(i32 %D) {
2006-10-23 20:54:35 +02:00
entry:
%tmp29 = icmp eq i32 0, 0 ; <i1> [#uses=1]
br i1 %tmp29, label %cond_next50, label %cond_next37
cond_next37: ; preds = %entry
ret void
cond_next50: ; preds = %entry
%tmp52 = icmp sgt i32 %D, 0 ; <i1> [#uses=1]
br i1 %tmp52, label %cond_true53, label %cond_next71
cond_true53: ; preds = %cond_next50
%tmp54 = load i32, i32* @JUMP ; <i32> [#uses=1]
%tmp55 = icmp eq i32 %tmp54, 1 ; <i1> [#uses=1]
br i1 %tmp55, label %cond_true56, label %cond_next63
cond_true56: ; preds = %cond_true53
%tmp57 = bitcast i32 %D to i32 ; <i32> [#uses=1]
call void @asearch1( i32 %tmp57 )
ret void
cond_next63: ; preds = %cond_true53
ret void
cond_next71: ; preds = %cond_next50
ret void
2006-10-23 20:54:35 +02:00
}
declare i32 @read()
2006-10-23 20:54:35 +02:00
define void @initial_value() {
2006-10-23 20:54:35 +02:00
entry:
ret void
2006-10-23 20:54:35 +02:00
}
define void @main() {
2006-10-23 20:54:35 +02:00
entry:
br label %cond_next252
cond_next208: ; preds = %cond_true260
%tmp229 = call i32 @atoi( ) ; <i32> [#uses=1]
br label %cond_next252
bb217: ; preds = %cond_true260
ret void
cond_next252: ; preds = %cond_next208, %entry
%D.0.0 = phi i32 [ 0, %entry ], [ %tmp229, %cond_next208 ] ; <i32> [#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-27 20:29:02 +01:00
%tmp254 = getelementptr i8*, i8** null, i32 1 ; <i8**> [#uses=1]
%tmp256 = load i8*, i8** %tmp254 ; <i8*> [#uses=1]
%tmp258 = load i8, i8* %tmp256 ; <i8> [#uses=1]
%tmp259 = icmp eq i8 %tmp258, 45 ; <i1> [#uses=1]
br i1 %tmp259, label %cond_true260, label %bb263
cond_true260: ; preds = %cond_next252
%tmp205818 = icmp sgt i8 0, -1 ; <i1> [#uses=1]
br i1 %tmp205818, label %cond_next208, label %bb217
bb263: ; preds = %cond_next252
%tmp265 = icmp eq i32 0, 0 ; <i1> [#uses=1]
br i1 %tmp265, label %cond_next276, label %cond_true266
cond_true266: ; preds = %bb263
ret void
cond_next276: ; preds = %bb263
%tmp278 = icmp eq i32 0, 0 ; <i1> [#uses=1]
br i1 %tmp278, label %cond_next298, label %cond_true279
cond_true279: ; preds = %cond_next276
ret void
cond_next298: ; preds = %cond_next276
call void @bitap( i32 %D.0.0 )
ret void
2006-10-23 20:54:35 +02:00
}
declare i32 @atoi()
2006-10-23 20:54:35 +02:00
define void @subset_pset() {
2006-10-23 20:54:35 +02:00
entry:
ret void
2006-10-23 20:54:35 +02:00
}
define void @strcmp() {
2006-10-23 20:54:35 +02:00
entry:
ret void
2006-10-23 20:54:35 +02:00
}