mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-31 20:51:52 +01:00
Remove llvm-upgrade.
llvm-svn: 47110
This commit is contained in:
parent
b714906acf
commit
f37f44f9ec
@ -1,17 +1,15 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -anders-aa -load-vn -gcse -deadargelim | llvm-dis | not grep ARG
|
||||
; RUN: llvm-as < %s | opt -anders-aa -load-vn -gcse -deadargelim | llvm-dis | not grep ARG
|
||||
|
||||
%G = internal constant int* null
|
||||
@G = internal constant i32* null
|
||||
|
||||
implementation
|
||||
|
||||
internal int %internal(int* %ARG) {
|
||||
define internal i32 @internal(i32* %ARG) {
|
||||
;; The 'Arg' argument must-aliases the null pointer, so it can be subsituted
|
||||
;; directly here, making it dead.
|
||||
store int* %ARG, int** %G
|
||||
ret int 0
|
||||
store i32* %ARG, i32** @G
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
int %foo() {
|
||||
%V = call int %internal(int* null)
|
||||
ret int %V
|
||||
define i32 @foo() {
|
||||
%V = call i32 @internal(i32* null)
|
||||
ret i32 %V
|
||||
}
|
||||
|
@ -1,30 +1,28 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -anders-aa -aa-eval
|
||||
; RUN: llvm-as < %s | opt -anders-aa -aa-eval
|
||||
|
||||
implementation
|
||||
|
||||
void %test1() {
|
||||
%X = malloc int*
|
||||
%Y = malloc int
|
||||
%Z = cast int* %Y to int
|
||||
%W = cast int %Z to int*
|
||||
store int* %W, int** %X
|
||||
define void @test1() {
|
||||
%X = malloc i32*
|
||||
%Y = malloc i32
|
||||
%Z = ptrtoint i32* %Y to i32
|
||||
%W = inttoptr i32 %Z to i32*
|
||||
store i32* %W, i32** %X
|
||||
ret void
|
||||
}
|
||||
|
||||
void %test2(int* %P) {
|
||||
%X = malloc int*
|
||||
%Y = malloc int
|
||||
store int* %P, int** %X
|
||||
define void @test2(i32* %P) {
|
||||
%X = malloc i32*
|
||||
%Y = malloc i32
|
||||
store i32* %P, i32** %X
|
||||
ret void
|
||||
}
|
||||
|
||||
internal int *%test3(int* %P) {
|
||||
ret int* %P
|
||||
define internal i32 *@test3(i32* %P) {
|
||||
ret i32* %P
|
||||
}
|
||||
|
||||
void %test4() {
|
||||
%X = malloc int
|
||||
%Y = call int* %test3(int* %X)
|
||||
%ZZ = getelementptr int* null, int 17
|
||||
define void @test4() {
|
||||
%X = malloc i32
|
||||
%Y = call i32* @test3(i32* %X)
|
||||
%ZZ = getelementptr i32* null, i32 17
|
||||
ret void
|
||||
}
|
||||
|
@ -1,22 +1,20 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -anders-aa -load-vn -gcse -deadargelim | llvm-dis | grep store | not grep null
|
||||
; RUN: llvm-as < %s | opt -anders-aa -load-vn -gcse -deadargelim | llvm-dis | grep store | not grep null
|
||||
|
||||
; Because the 'internal' function is passed to an external function, we don't
|
||||
; know what the incoming values will alias. As such, we cannot do the
|
||||
; optimization checked by the 'arg-must-alias.llx' test.
|
||||
|
||||
declare void %external(int(int*)*)
|
||||
%G = internal constant int* null
|
||||
declare void @external(i32(i32*)*)
|
||||
@G = internal constant i32* null
|
||||
|
||||
implementation
|
||||
|
||||
internal int %internal(int* %ARG) {
|
||||
define internal i32 @internal(i32* %ARG) {
|
||||
;;; We *DON'T* know that ARG always points to null!
|
||||
store int* %ARG, int** %G
|
||||
ret int 0
|
||||
store i32* %ARG, i32** @G
|
||||
ret i32 0
|
||||
}
|
||||
|
||||
int %foo() {
|
||||
call void %external(int(int*)* %internal)
|
||||
%V = call int %internal(int* null)
|
||||
ret int %V
|
||||
define i32 @foo() {
|
||||
call void @external(i32(i32*)* @internal)
|
||||
%V = call i32 @internal(i32* null)
|
||||
ret i32 %V
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | \
|
||||
; RUN: opt -anders-aa -load-vn -gcse -instcombine | llvm-dis | \
|
||||
; RUN: grep {ret i1 true}
|
||||
; RUN: llvm-as < %s | opt -anders-aa -load-vn -gcse -instcombine | llvm-dis \
|
||||
; RUN: | grep {ret i1 true}
|
||||
|
||||
%G = internal global int* null
|
||||
declare int *%ext()
|
||||
bool %bar() {
|
||||
%V1 = load int** %G
|
||||
%X2 = call int *%ext()
|
||||
%V2 = load int** %G
|
||||
store int* %X2, int** %G
|
||||
@G = internal global i32* null
|
||||
declare i32 *@ext()
|
||||
|
||||
%C = seteq int* %V1, %V2
|
||||
ret bool %C
|
||||
define i1 @bar() {
|
||||
%V1 = load i32** @G
|
||||
%X2 = call i32 *@ext()
|
||||
%V2 = load i32** @G
|
||||
store i32* %X2, i32** @G
|
||||
|
||||
%C = icmp eq i32* %V1, %V2
|
||||
ret i1 %C
|
||||
}
|
||||
|
@ -1,3 +1,3 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -anders-aa -disable-output
|
||||
; RUN: llvm-as < %s | opt -anders-aa -disable-output
|
||||
|
||||
void %foo() { ret void }
|
||||
define void @foo() { ret void }
|
||||
|
@ -2,17 +2,17 @@
|
||||
; is performed. It is not legal to delete the second load instruction because
|
||||
; the value computed by the first load instruction is changed by the store.
|
||||
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse -instcombine | llvm-dis | grep DONOTREMOVE
|
||||
; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | grep DONOTREMOVE
|
||||
|
||||
int %test() {
|
||||
%A = alloca int
|
||||
store int 0, int* %A
|
||||
%X = load int* %A
|
||||
%B = cast int* %A to sbyte*
|
||||
%C = getelementptr sbyte* %B, long 1
|
||||
store sbyte 1, sbyte* %C ; Aliases %A
|
||||
%Y.DONOTREMOVE = load int* %A
|
||||
%Z = sub int %X, %Y.DONOTREMOVE
|
||||
ret int %Z
|
||||
define i32 @test() {
|
||||
%A = alloca i32
|
||||
store i32 0, i32* %A
|
||||
%X = load i32* %A
|
||||
%B = bitcast i32* %A to i8*
|
||||
%C = getelementptr i8* %B, i64 1
|
||||
store i8 1, i8* %C ; Aliases %A
|
||||
%Y.DONOTREMOVE = load i32* %A
|
||||
%Z = sub i32 %X, %Y.DONOTREMOVE
|
||||
ret i32 %Z
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -aa-eval -disable-output
|
||||
; RUN: llvm-as < %s | opt -basicaa -aa-eval -disable-output
|
||||
; Test for a bug in BasicAA which caused a crash when querying equality of P1&P2
|
||||
void %test({[2 x int],[2 x int]}* %A, long %X, long %Y) {
|
||||
%P1 = getelementptr {[2 x int],[2 x int]}* %A, long 0, uint 0, long %X
|
||||
%P2 = getelementptr {[2 x int],[2 x int]}* %A, long 0, uint 1, long %Y
|
||||
define void @test({[2 x i32],[2 x i32]}* %A, i64 %X, i64 %Y) {
|
||||
%P1 = getelementptr {[2 x i32],[2 x i32]}* %A, i64 0, i32 0, i64 %X
|
||||
%P2 = getelementptr {[2 x i32],[2 x i32]}* %A, i64 0, i32 1, i64 %Y
|
||||
ret void
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse -instcombine | llvm-dis | grep sub
|
||||
; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | grep sub
|
||||
|
||||
; BasicAA was incorrectly concluding that P1 and P2 didn't conflict!
|
||||
|
||||
int %test(int *%Ptr, long %V) {
|
||||
%P2 = getelementptr int* %Ptr, long 1
|
||||
%P1 = getelementptr int* %Ptr, long %V
|
||||
%X = load int* %P1
|
||||
store int 5, int* %P2
|
||||
define i32 @test(i32 *%Ptr, i64 %V) {
|
||||
%P2 = getelementptr i32* %Ptr, i64 1
|
||||
%P1 = getelementptr i32* %Ptr, i64 %V
|
||||
%X = load i32* %P1
|
||||
store i32 5, i32* %P2
|
||||
|
||||
%Y = load int* %P1
|
||||
%Y = load i32* %P1
|
||||
|
||||
%Z = sub int %X, %Y
|
||||
ret int %Z
|
||||
%Z = sub i32 %X, %Y
|
||||
ret i32 %Z
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -aa-eval -disable-output
|
||||
; RUN: llvm-as < %s | opt -basicaa -aa-eval -disable-output
|
||||
; Test for a bug in BasicAA which caused a crash when querying equality of P1&P2
|
||||
void %test([17 x ushort]* %mask_bits) {
|
||||
%P1 = getelementptr [17 x ushort]* %mask_bits, long 0, long 0
|
||||
%P2 = getelementptr [17 x ushort]* %mask_bits, long 252645134, long 0
|
||||
define void @test([17 x i16]* %mask_bits) {
|
||||
%P1 = getelementptr [17 x i16]* %mask_bits, i64 0, i64 0
|
||||
%P2 = getelementptr [17 x i16]* %mask_bits, i64 252645134, i64 0
|
||||
ret void
|
||||
}
|
||||
|
@ -1,19 +1,19 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm -disable-output
|
||||
%struct..apr_array_header_t = type { int*, int, int, int, sbyte* }
|
||||
%struct..apr_table_t = type { %struct..apr_array_header_t, uint, [32 x int], [32 x int] }
|
||||
; RUN: llvm-as < %s | opt -licm -disable-output
|
||||
%struct..apr_array_header_t = type { i32*, i32, i32, i32, i8* }
|
||||
%struct..apr_table_t = type { %struct..apr_array_header_t, i32, [32 x i32], [32 x i32] }
|
||||
|
||||
void %table_reindex(%struct..apr_table_t* %t.1) { ; No predecessors!
|
||||
define void @table_reindex(%struct..apr_table_t* %t.1) { ; No predecessors!
|
||||
br label %loopentry
|
||||
|
||||
loopentry: ; preds = %0, %no_exit
|
||||
%tmp.101 = getelementptr %struct..apr_table_t* %t.1, long 0, uint 0, uint 2
|
||||
%tmp.11 = load int* %tmp.101 ; <int> [#uses=0]
|
||||
br bool false, label %no_exit, label %UnifiedExitNode
|
||||
%tmp.101 = getelementptr %struct..apr_table_t* %t.1, i64 0, i32 0, i32 2
|
||||
%tmp.11 = load i32* %tmp.101 ; <i32> [#uses=0]
|
||||
br i1 false, label %no_exit, label %UnifiedExitNode
|
||||
|
||||
no_exit: ; preds = %loopentry
|
||||
%tmp.25 = cast int 0 to long ; <long> [#uses=1]
|
||||
%tmp.261 = getelementptr %struct..apr_table_t* %t.1, long 0, uint 3, long %tmp.25 ; <int*> [#uses=1]
|
||||
store int 0, int* %tmp.261
|
||||
%tmp.25 = sext i32 0 to i64 ; <i64> [#uses=1]
|
||||
%tmp.261 = getelementptr %struct..apr_table_t* %t.1, i64 0, i32 3, i64 %tmp.25 ; <i32*> [#uses=1]
|
||||
store i32 0, i32* %tmp.261
|
||||
br label %loopentry
|
||||
|
||||
UnifiedExitNode: ; preds = %loopentry
|
||||
|
@ -1,11 +1,11 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -aa-eval -disable-output
|
||||
; RUN: llvm-as < %s | opt -basicaa -aa-eval -disable-output
|
||||
|
||||
int %MTConcat([3 x int]* %a.1) {
|
||||
%tmp.961 = getelementptr [3 x int]* %a.1, long 0, long 4
|
||||
%tmp.97 = load int* %tmp.961
|
||||
%tmp.119 = getelementptr [3 x int]* %a.1, long 1, long 0
|
||||
%tmp.120 = load int* %tmp.119
|
||||
%tmp.1541 = getelementptr [3 x int]* %a.1, long 0, long 4
|
||||
%tmp.155 = load int* %tmp.1541
|
||||
ret int 0
|
||||
define i32 @MTConcat([3 x i32]* %a.1) {
|
||||
%tmp.961 = getelementptr [3 x i32]* %a.1, i64 0, i64 4
|
||||
%tmp.97 = load i32* %tmp.961
|
||||
%tmp.119 = getelementptr [3 x i32]* %a.1, i64 1, i64 0
|
||||
%tmp.120 = load i32* %tmp.119
|
||||
%tmp.1541 = getelementptr [3 x i32]* %a.1, i64 0, i64 4
|
||||
%tmp.155 = load i32* %tmp.1541
|
||||
ret i32 0
|
||||
}
|
||||
|
@ -1,12 +1,10 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -aa-eval -disable-output
|
||||
; RUN: llvm-as < %s | opt -basicaa -aa-eval -disable-output
|
||||
|
||||
%struct..RefPoint = type { int, { uint, ushort, ushort } }
|
||||
%struct..RefRect = type { %struct..RefPoint, %struct..RefPoint }
|
||||
%struct..RefPoint = type { i32, { i32, i8, i8 } }
|
||||
%struct..RefRect = type { %struct..RefPoint, %struct..RefPoint }
|
||||
|
||||
implementation ; Functions:
|
||||
|
||||
uint %BMT_CommitPartDrawObj() {
|
||||
%tmp.19111 = getelementptr %struct..RefRect* null, long 0, uint 0, uint 1, uint 2
|
||||
%tmp.20311 = getelementptr %struct..RefRect* null, long 0, uint 1, uint 1, uint 2
|
||||
ret uint 0
|
||||
define i32 @BMT_CommitPartDrawObj() {
|
||||
%tmp.19111 = getelementptr %struct..RefRect* null, i64 0, i32 0, i32 1, i32 2
|
||||
%tmp.20311 = getelementptr %struct..RefRect* null, i64 0, i32 1, i32 1, i32 2
|
||||
ret i32 0
|
||||
}
|
||||
|
@ -1,12 +1,12 @@
|
||||
; In this test, a local alloca cannot alias an incoming argument.
|
||||
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse -instcombine | llvm-dis | not grep sub
|
||||
; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | not grep sub
|
||||
|
||||
int %test(int* %P) {
|
||||
%X = alloca int
|
||||
%V1 = load int* %P
|
||||
store int 0, int* %X
|
||||
%V2 = load int* %P
|
||||
%Diff = sub int %V1, %V2
|
||||
ret int %Diff
|
||||
define i32 @test(i32* %P) {
|
||||
%X = alloca i32
|
||||
%V1 = load i32* %P
|
||||
store i32 0, i32* %X
|
||||
%V2 = load i32* %P
|
||||
%Diff = sub i32 %V1, %V2
|
||||
ret i32 %Diff
|
||||
}
|
||||
|
@ -1,16 +1,16 @@
|
||||
; This testcase consists of alias relations which should be completely
|
||||
; resolvable by basicaa.
|
||||
|
||||
; RUN: llvm-upgrade < %s | llvm-as | \
|
||||
; RUN: opt -aa-eval -print-may-aliases -disable-output |& not grep May:
|
||||
; RUN: llvm-as < %s | opt -aa-eval -print-may-aliases -disable-output \
|
||||
; RUN: |& not grep May:
|
||||
|
||||
%T = type { uint, [10 x ubyte] }
|
||||
%T = type { i32, [10 x i8] }
|
||||
|
||||
void %test(%T* %P) {
|
||||
%A = getelementptr %T* %P, long 0
|
||||
%B = getelementptr %T* %P, long 0, uint 0
|
||||
%C = getelementptr %T* %P, long 0, uint 1
|
||||
%D = getelementptr %T* %P, long 0, uint 1, long 0
|
||||
%E = getelementptr %T* %P, long 0, uint 1, long 5
|
||||
define void @test(%T* %P) {
|
||||
%A = getelementptr %T* %P, i64 0
|
||||
%B = getelementptr %T* %P, i64 0, i32 0
|
||||
%C = getelementptr %T* %P, i64 0, i32 1
|
||||
%D = getelementptr %T* %P, i64 0, i32 1, i64 0
|
||||
%E = getelementptr %T* %P, i64 0, i32 1, i64 5
|
||||
ret void
|
||||
}
|
||||
|
@ -1,18 +1,18 @@
|
||||
; This testcase consists of alias relations which should be completely
|
||||
; resolvable by basicaa, but require analysis of getelementptr constant exprs.
|
||||
|
||||
; RUN: llvm-upgrade < %s | llvm-as | \
|
||||
; RUN: opt -aa-eval -print-may-aliases -disable-output |& not grep May:
|
||||
; RUN: llvm-as < %s | opt -aa-eval -print-may-aliases -disable-output \
|
||||
; RUN: |& not grep May:
|
||||
|
||||
%T = type { uint, [10 x ubyte] }
|
||||
%T = type { i32, [10 x i8] }
|
||||
|
||||
%G = external global %T
|
||||
@G = external global %T
|
||||
|
||||
void %test() {
|
||||
%D = getelementptr %T* %G, long 0, uint 0
|
||||
%E = getelementptr %T* %G, long 0, uint 1, long 5
|
||||
%F = getelementptr uint* getelementptr (%T* %G, long 0, uint 0), long 0
|
||||
%X = getelementptr [10 x ubyte]* getelementptr (%T* %G, long 0, uint 1), long 0, long 5
|
||||
define void @test() {
|
||||
%D = getelementptr %T* @G, i64 0, i32 0
|
||||
%E = getelementptr %T* @G, i64 0, i32 1, i64 5
|
||||
%F = getelementptr i32* getelementptr (%T* @G, i64 0, i32 0), i64 0
|
||||
%X = getelementptr [10 x i8]* getelementptr (%T* @G, i64 0, i32 1), i64 0, i64 5
|
||||
|
||||
ret void
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse -instcombine | \
|
||||
; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | \
|
||||
; RUN: llvm-dis | not grep load
|
||||
|
||||
%X = constant [2 x int] [int 4, int 5]
|
||||
@X = constant [2 x i32] [i32 4, i32 5]
|
||||
|
||||
int %test(int* %Y, long %idx) {
|
||||
%P = getelementptr [2 x int]* %X, long 0, long %idx
|
||||
%A = load int* %P ; Load from invariant memory
|
||||
store int 4, int* %Y ; Store could not be to %X
|
||||
%B = load int* %P
|
||||
%C = sub int %A, %B
|
||||
ret int %C
|
||||
define i32 @test(i32* %Y, i64 %idx) {
|
||||
%P = getelementptr [2 x i32]* @X, i64 0, i64 %idx
|
||||
%A = load i32* %P ; Load from invariant memory
|
||||
store i32 4, i32* %Y ; Store could not be to @X
|
||||
%B = load i32* %P
|
||||
%C = sub i32 %A, %B
|
||||
ret i32 %C
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -dse | llvm-dis | grep {store i32 0}
|
||||
; RUN: llvm-as < %s | opt -dse | llvm-dis | grep {store i32 0}
|
||||
|
||||
void %test({int,int }* %P) {
|
||||
%Q = getelementptr {int,int}* %P, int 1
|
||||
%X = getelementptr {int,int}* %Q, int 0, uint 1
|
||||
%Y = getelementptr {int,int}* %Q, int 1, uint 1
|
||||
store int 0, int* %X
|
||||
store int 1, int* %Y
|
||||
define void @test({i32,i32 }* %P) {
|
||||
%Q = getelementptr {i32,i32}* %P, i32 1
|
||||
%X = getelementptr {i32,i32}* %Q, i32 0, i32 1
|
||||
%Y = getelementptr {i32,i32}* %Q, i32 1, i32 1
|
||||
store i32 0, i32* %X
|
||||
store i32 1, i32* %Y
|
||||
ret void
|
||||
}
|
||||
|
@ -1,24 +1,22 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm
|
||||
; RUN: llvm-as < %s | opt -licm
|
||||
|
||||
"java/lang/Object" = type { %struct.llvm_java_object_base }
|
||||
"java/lang/StringBuffer" = type { "java/lang/Object", int, { "java/lang/Object", uint, [0 x ushort] }*, bool }
|
||||
%struct.llvm_java_object_base = type opaque
|
||||
%"java/lang/Object" = type { %struct.llvm_java_object_base }
|
||||
%"java/lang/StringBuffer" = type { "java/lang/Object", i32, { "java/lang/Object", i32, [0 x i8] }*, i1 }
|
||||
%struct.llvm_java_object_base = type opaque
|
||||
|
||||
implementation ; Functions:
|
||||
|
||||
void "java/lang/StringBuffer/setLength(I)V"(%struct.llvm_java_object_base*) {
|
||||
define void @"java/lang/StringBuffer/setLength(I)V"(%struct.llvm_java_object_base*) {
|
||||
bc0:
|
||||
br bool false, label %bc40, label %bc65
|
||||
br i1 false, label %bc40, label %bc65
|
||||
|
||||
bc65: ; preds = %bc0, %bc40
|
||||
ret void
|
||||
|
||||
bc40: ; preds = %bc0, %bc40
|
||||
%tmp75 = cast %struct.llvm_java_object_base* %0 to "java/lang/StringBuffer"* ; <"java/lang/StringBuffer"*> [#uses=1]
|
||||
%tmp76 = getelementptr "java/lang/StringBuffer"* %tmp75, int 0, uint 1 ; <int*> [#uses=1]
|
||||
store int 0, int* %tmp76
|
||||
%tmp381 = cast %struct.llvm_java_object_base* %0 to "java/lang/StringBuffer"* ; <"java/lang/StringBuffer"*> [#uses=1]
|
||||
%tmp392 = getelementptr "java/lang/StringBuffer"* %tmp381, int 0, uint 1 ; <int*> [#uses=1]
|
||||
%tmp403 = load int* %tmp392 ; <int> [#uses=0]
|
||||
br bool false, label %bc40, label %bc65
|
||||
%tmp75 = bitcast %struct.llvm_java_object_base* %0 to %"java/lang/StringBuffer"* ; <"java/lang/StringBuffer"*> [#uses=1]
|
||||
%tmp76 = getelementptr %"java/lang/StringBuffer"* %tmp75, i32 0, i32 1 ; <i32*> [#uses=1]
|
||||
store i32 0, i32* %tmp76
|
||||
%tmp381 = bitcast %struct.llvm_java_object_base* %0 to %"java/lang/StringBuffer"* ; <"java/lang/StringBuffer"*> [#uses=1]
|
||||
%tmp392 = getelementptr %"java/lang/StringBuffer"* %tmp381, i32 0, i32 1 ; <i32*> [#uses=1]
|
||||
%tmp403 = load i32* %tmp392 ; <i32> [#uses=0]
|
||||
br i1 false, label %bc40, label %bc65
|
||||
}
|
||||
|
@ -1,20 +1,18 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -dse
|
||||
; RUN: llvm-as < %s | opt -dse
|
||||
|
||||
"java/lang/Object" = type { %struct.llvm_java_object_base }
|
||||
"java/lang/StringBuffer" = type { "java/lang/Object", int, { "java/lang/Object", uint, [0 x ushort] }*, bool }
|
||||
%struct.llvm_java_object_base = type opaque
|
||||
%"java/lang/Object" = type { %struct.llvm_java_object_base }
|
||||
%"java/lang/StringBuffer" = type { "java/lang/Object", i32, { "java/lang/Object", i32, [0 x i8] }*, i1 }
|
||||
%struct.llvm_java_object_base = type opaque
|
||||
|
||||
implementation ; Functions:
|
||||
|
||||
void "java/lang/StringBuffer/ensureCapacity_unsynchronized(I)V"() {
|
||||
define void @"java/lang/StringBuffer/ensureCapacity_unsynchronized(I)V"() {
|
||||
bc0:
|
||||
%tmp = getelementptr "java/lang/StringBuffer"* null, int 0, uint 3 ; <bool*> [#uses=1]
|
||||
br bool false, label %bc16, label %bc7
|
||||
%tmp = getelementptr %"java/lang/StringBuffer"* null, i32 0, i32 3 ; <i1*> [#uses=1]
|
||||
br i1 false, label %bc16, label %bc7
|
||||
|
||||
bc16: ; preds = %bc0
|
||||
%tmp91 = getelementptr "java/lang/StringBuffer"* null, int 0, uint 2 ; <{ "java/lang/Object", uint, [0 x ushort] }**> [#uses=1]
|
||||
store { "java/lang/Object", uint, [0 x ushort] }* null, { "java/lang/Object", uint, [0 x ushort] }** %tmp91
|
||||
store bool false, bool* %tmp
|
||||
%tmp91 = getelementptr %"java/lang/StringBuffer"* null, i32 0, i32 2 ; <{ "java/lang/Object", i32, [0 x i8] }**> [#uses=1]
|
||||
store { %"java/lang/Object", i32, [0 x i8] }* null, { %"java/lang/Object", i32, [0 x i8] }** %tmp91
|
||||
store i1 false, i1* %tmp
|
||||
ret void
|
||||
|
||||
bc7: ; preds = %bc0
|
||||
|
@ -1,15 +1,15 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -load-vn -gcse -instcombine |\
|
||||
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine |\
|
||||
; RUN: llvm-dis | grep {load i32\\* %A}
|
||||
|
||||
declare double* %useit(int*)
|
||||
declare double* @useit(i32*)
|
||||
|
||||
int %foo(uint %Amt) {
|
||||
%A = malloc int, uint %Amt
|
||||
%P = call double* %useit(int* %A)
|
||||
define i32 @foo(i32 %Amt) {
|
||||
%A = malloc i32, i32 %Amt
|
||||
%P = call double* @useit(i32* %A)
|
||||
|
||||
%X = load int* %A
|
||||
%X = load i32* %A
|
||||
store double 0.0, double* %P
|
||||
%Y = load int* %A
|
||||
%Z = sub int %X, %Y
|
||||
ret int %Z
|
||||
%Y = load i32* %A
|
||||
%Z = sub i32 %X, %Y
|
||||
ret i32 %Z
|
||||
}
|
||||
|
@ -1,32 +1,30 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | \
|
||||
; RUN: opt -aa-eval -disable-output |& grep {2 no alias respon}
|
||||
; RUN: llvm-as < %s | opt -aa-eval -disable-output |& grep {2 no alias respon}
|
||||
; TEST that A[1][0] may alias A[0][i].
|
||||
|
||||
;; TEST that A[1][0] may alias A[0][i].
|
||||
|
||||
void %test(int %N) {
|
||||
define void @test(i32 %N) {
|
||||
entry:
|
||||
%X = alloca [3 x [3 x int]] ; <[3 x [3 x int]]*> [#uses=4]
|
||||
%tmp.24 = setgt int %N, 0 ; <bool> [#uses=1]
|
||||
br bool %tmp.24, label %no_exit, label %loopexit
|
||||
%X = alloca [3 x [3 x i32]] ; <[3 x [3 x i32]]*> [#uses=4]
|
||||
%tmp.24 = icmp sgt i32 %N, 0 ; <i1> [#uses=1]
|
||||
br i1 %tmp.24, label %no_exit, label %loopexit
|
||||
|
||||
no_exit: ; preds = %no_exit, %entry
|
||||
%i.0.0 = phi int [ 0, %entry ], [ %inc, %no_exit ] ; <int> [#uses=2]
|
||||
%tmp.6 = getelementptr [3 x [3 x int]]* %X, int 0, int 0, int %i.0.0 ; <int*> [#uses=1]
|
||||
store int 1, int* %tmp.6
|
||||
%tmp.8 = getelementptr [3 x [3 x int]]* %X, int 0, int 0, int 0 ; <int*> [#uses=1]
|
||||
%tmp.9 = load int* %tmp.8 ; <int> [#uses=1]
|
||||
%tmp.11 = getelementptr [3 x [3 x int]]* %X, int 0, int 1, int 0 ; <int*> [#uses=1]
|
||||
%tmp.12 = load int* %tmp.11 ; <int> [#uses=1]
|
||||
%tmp.13 = add int %tmp.12, %tmp.9 ; <int> [#uses=1]
|
||||
%inc = add int %i.0.0, 1 ; <int> [#uses=2]
|
||||
%tmp.2 = setlt int %inc, %N ; <bool> [#uses=1]
|
||||
br bool %tmp.2, label %no_exit, label %loopexit
|
||||
%i.0.0 = phi i32 [ 0, %entry ], [ %inc, %no_exit ] ; <i32> [#uses=2]
|
||||
%tmp.6 = getelementptr [3 x [3 x i32]]* %X, i32 0, i32 0, i32 %i.0.0 ; <i32*> [#uses=1]
|
||||
store i32 1, i32* %tmp.6
|
||||
%tmp.8 = getelementptr [3 x [3 x i32]]* %X, i32 0, i32 0, i32 0 ; <i32*> [#uses=1]
|
||||
%tmp.9 = load i32* %tmp.8 ; <i32> [#uses=1]
|
||||
%tmp.11 = getelementptr [3 x [3 x i32]]* %X, i32 0, i32 1, i32 0 ; <i32*> [#uses=1]
|
||||
%tmp.12 = load i32* %tmp.11 ; <i32> [#uses=1]
|
||||
%tmp.13 = add i32 %tmp.12, %tmp.9 ; <i32> [#uses=1]
|
||||
%inc = add i32 %i.0.0, 1 ; <i32> [#uses=2]
|
||||
%tmp.2 = icmp slt i32 %inc, %N ; <i1> [#uses=1]
|
||||
br i1 %tmp.2, label %no_exit, label %loopexit
|
||||
|
||||
loopexit: ; preds = %no_exit, %entry
|
||||
%Y.0.1 = phi int [ 0, %entry ], [ %tmp.13, %no_exit ] ; <int> [#uses=1]
|
||||
%tmp.4 = getelementptr [3 x [3 x int]]* %X, int 0, int 0 ; <[3 x int]*> [#uses=1]
|
||||
%tmp.15 = call int (...)* %foo( [3 x int]* %tmp.4, int %Y.0.1 ) ; <int> [#uses=0]
|
||||
%Y.0.1 = phi i32 [ 0, %entry ], [ %tmp.13, %no_exit ] ; <i32> [#uses=1]
|
||||
%tmp.4 = getelementptr [3 x [3 x i32]]* %X, i32 0, i32 0 ; <[3 x i32]*> [#uses=1]
|
||||
%tmp.15 = call i32 (...)* @foo( [3 x i32]* %tmp.4, i32 %Y.0.1 ) ; <i32> [#uses=0]
|
||||
ret void
|
||||
}
|
||||
|
||||
declare int %foo(...)
|
||||
declare i32 @foo(...)
|
||||
|
@ -1,33 +1,30 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -licm -disable-output
|
||||
target endian = big
|
||||
target pointersize = 32
|
||||
; RUN: llvm-as < %s | opt -licm -disable-output
|
||||
target datalayout = "E-p:32:32"
|
||||
target triple = "powerpc-apple-darwin8.7.0"
|
||||
|
||||
implementation ; Functions:
|
||||
|
||||
void %glgRunProcessor() {
|
||||
define void @glgRunProcessor() {
|
||||
entry:
|
||||
br bool false, label %bb2037.i, label %cond_true.i18
|
||||
br i1 false, label %bb2037.i, label %cond_true.i18
|
||||
|
||||
cond_true.i18: ; preds = %entry
|
||||
ret void
|
||||
|
||||
bb205.i: ; preds = %bb2037.i
|
||||
switch uint 0, label %bb1013.i [
|
||||
uint 14, label %bb239.i
|
||||
uint 15, label %bb917.i
|
||||
switch i32 0, label %bb1013.i [
|
||||
i32 14, label %bb239.i
|
||||
i32 15, label %bb917.i
|
||||
]
|
||||
|
||||
bb239.i: ; preds = %bb205.i
|
||||
br bool false, label %cond_false277.i, label %cond_true264.i
|
||||
br i1 false, label %cond_false277.i, label %cond_true264.i
|
||||
|
||||
cond_true264.i: ; preds = %bb239.i
|
||||
ret void
|
||||
|
||||
cond_false277.i: ; preds = %bb239.i
|
||||
%tmp1062.i = getelementptr [2 x <4 x int>]* null, int 0, int 1 ; <<4 x int>*> [#uses=1]
|
||||
store <4 x int> zeroinitializer, <4 x int>* %tmp1062.i
|
||||
br bool false, label %cond_true1032.i, label %cond_false1063.i85
|
||||
%tmp1062.i = getelementptr [2 x <4 x i32>]* null, i32 0, i32 1 ; <<4 x i32>*> [#uses=1]
|
||||
store <4 x i32> zeroinitializer, <4 x i32>* %tmp1062.i
|
||||
br i1 false, label %cond_true1032.i, label %cond_false1063.i85
|
||||
|
||||
bb917.i: ; preds = %bb205.i
|
||||
ret void
|
||||
@ -36,15 +33,15 @@ bb1013.i: ; preds = %bb205.i
|
||||
ret void
|
||||
|
||||
cond_true1032.i: ; preds = %cond_false277.i
|
||||
%tmp1187.i = getelementptr [2 x <4 x int>]* null, int 0, int 0, int 7 ; <int*> [#uses=1]
|
||||
store int 0, int* %tmp1187.i
|
||||
%tmp1187.i = getelementptr [2 x <4 x i32>]* null, i32 0, i32 0, i32 7 ; <i32*> [#uses=1]
|
||||
store i32 0, i32* %tmp1187.i
|
||||
br label %bb2037.i
|
||||
|
||||
cond_false1063.i85: ; preds = %cond_false277.i
|
||||
ret void
|
||||
|
||||
bb2037.i: ; preds = %cond_true1032.i, %entry
|
||||
br bool false, label %bb205.i, label %cond_next2042.i
|
||||
br i1 false, label %bb205.i, label %cond_next2042.i
|
||||
|
||||
cond_next2042.i: ; preds = %bb2037.i
|
||||
ret void
|
||||
|
@ -1,85 +1,82 @@
|
||||
; This testcase tests for various features the basicaa test should be able to
|
||||
; determine, as noted in the comments.
|
||||
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -load-vn -gcse -instcombine -dce | llvm-dis | not grep REMOVE
|
||||
|
||||
%Global = external global { int }
|
||||
|
||||
implementation
|
||||
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine -dce | llvm-dis | not grep REMOVE
|
||||
|
||||
@Global = external global { i32 }
|
||||
|
||||
; Array test: Test that operations on one local array do not invalidate
|
||||
; operations on another array. Important for scientific codes.
|
||||
;
|
||||
int %different_array_test(long %A, long %B) {
|
||||
%Array1 = alloca int, uint 100
|
||||
%Array2 = alloca int, uint 200
|
||||
define i32 @different_array_test(i64 %A, i64 %B) {
|
||||
%Array1 = alloca i32, i32 100
|
||||
%Array2 = alloca i32, i32 200
|
||||
|
||||
%pointer = getelementptr int* %Array1, long %A
|
||||
%val = load int* %pointer
|
||||
%pointer = getelementptr i32* %Array1, i64 %A
|
||||
%val = load i32* %pointer
|
||||
|
||||
%pointer2 = getelementptr int* %Array2, long %B
|
||||
store int 7, int* %pointer2
|
||||
%pointer2 = getelementptr i32* %Array2, i64 %B
|
||||
store i32 7, i32* %pointer2
|
||||
|
||||
%REMOVE = load int* %pointer ; redundant with above load
|
||||
%retval = sub int %REMOVE, %val
|
||||
ret int %retval
|
||||
%REMOVE = load i32* %pointer ; redundant with above load
|
||||
%retval = sub i32 %REMOVE, %val
|
||||
ret i32 %retval
|
||||
}
|
||||
|
||||
; Constant index test: Constant indexes into the same array should not
|
||||
; interfere with each other. Again, important for scientific codes.
|
||||
;
|
||||
int %constant_array_index_test() {
|
||||
%Array = alloca int, uint 100
|
||||
%P1 = getelementptr int* %Array, long 7
|
||||
%P2 = getelementptr int* %Array, long 6
|
||||
define i32 @constant_array_index_test() {
|
||||
%Array = alloca i32, i32 100
|
||||
%P1 = getelementptr i32* %Array, i64 7
|
||||
%P2 = getelementptr i32* %Array, i64 6
|
||||
|
||||
%A = load int* %P1
|
||||
store int 1, int* %P2 ; Should not invalidate load
|
||||
%BREMOVE = load int* %P1
|
||||
%Val = sub int %A, %BREMOVE
|
||||
ret int %Val
|
||||
%A = load i32* %P1
|
||||
store i32 1, i32* %P2 ; Should not invalidate load
|
||||
%BREMOVE = load i32* %P1
|
||||
%Val = sub i32 %A, %BREMOVE
|
||||
ret i32 %Val
|
||||
}
|
||||
|
||||
; Test that if two pointers are spaced out by a constant getelementptr, that
|
||||
; they cannot alias.
|
||||
int %gep_distance_test(int* %A) {
|
||||
%REMOVEu = load int* %A
|
||||
%B = getelementptr int* %A, long 2 ; Cannot alias A
|
||||
store int 7, int* %B
|
||||
%REMOVEv = load int* %A
|
||||
%r = sub int %REMOVEu, %REMOVEv
|
||||
ret int %r
|
||||
define i32 @gep_distance_test(i32* %A) {
|
||||
%REMOVEu = load i32* %A
|
||||
%B = getelementptr i32* %A, i64 2 ; Cannot alias A
|
||||
store i32 7, i32* %B
|
||||
%REMOVEv = load i32* %A
|
||||
%r = sub i32 %REMOVEu, %REMOVEv
|
||||
ret i32 %r
|
||||
}
|
||||
|
||||
; Test that if two pointers are spaced out by a constant offset, that they
|
||||
; cannot alias, even if there is a variable offset between them...
|
||||
int %gep_distance_test2({int,int}* %A, long %distance) {
|
||||
%A = getelementptr {int,int}* %A, long 0, uint 0
|
||||
%REMOVEu = load int* %A
|
||||
%B = getelementptr {int,int}* %A, long %distance, uint 1
|
||||
store int 7, int* %B ; B cannot alias A, it's at least 4 bytes away
|
||||
%REMOVEv = load int* %A
|
||||
%r = sub int %REMOVEu, %REMOVEv
|
||||
ret int %r
|
||||
define i32 @gep_distance_test2({i32,i32}* %A, i64 %distance) {
|
||||
%A1 = getelementptr {i32,i32}* %A, i64 0, i32 0
|
||||
%REMOVEu = load i32* %A1
|
||||
%B = getelementptr {i32,i32}* %A, i64 %distance, i32 1
|
||||
store i32 7, i32* %B ; B cannot alias A, it's at least 4 bytes away
|
||||
%REMOVEv = load i32* %A1
|
||||
%r = sub i32 %REMOVEu, %REMOVEv
|
||||
ret i32 %r
|
||||
}
|
||||
|
||||
; Test that we can do funny pointer things and that distance calc will still
|
||||
; work.
|
||||
int %gep_distance_test3(int * %A) {
|
||||
%X = load int* %A
|
||||
%B = cast int* %A to sbyte*
|
||||
%C = getelementptr sbyte* %B, long 4
|
||||
%Y = load sbyte* %C
|
||||
ret int 8
|
||||
define i32 @gep_distance_test3(i32 * %A) {
|
||||
%X = load i32* %A
|
||||
%B = bitcast i32* %A to i8*
|
||||
%C = getelementptr i8* %B, i64 4
|
||||
%Y = load i8* %C
|
||||
ret i32 8
|
||||
}
|
||||
|
||||
; Test that we can disambiguate globals reached through constantexpr geps
|
||||
int %constexpr_test() {
|
||||
%X = alloca int
|
||||
%Y = load int* %X
|
||||
store int 5, int* getelementptr ({ int }* %Global, long 0, uint 0)
|
||||
%REMOVE = load int* %X
|
||||
%retval = sub int %Y, %REMOVE
|
||||
ret int %retval
|
||||
define i32 @constexpr_test() {
|
||||
%X = alloca i32
|
||||
%Y = load i32* %X
|
||||
store i32 5, i32* getelementptr ({ i32 }* @Global, i64 0, i32 0)
|
||||
%REMOVE = load i32* %X
|
||||
%retval = sub i32 %Y, %REMOVE
|
||||
ret i32 %retval
|
||||
}
|
||||
|
@ -2,45 +2,45 @@
|
||||
; disambiguating some obvious cases. All loads should be removable in
|
||||
; this testcase.
|
||||
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -load-vn -gcse -instcombine -dce | llvm-dis | not grep load
|
||||
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine -dce \
|
||||
; RUN: | llvm-dis | not grep load
|
||||
|
||||
%A = global int 7
|
||||
%B = global int 8
|
||||
implementation
|
||||
@A = global i32 7
|
||||
@B = global i32 8
|
||||
|
||||
int %test() {
|
||||
%A1 = load int* %A
|
||||
define i32 @test() {
|
||||
%A1 = load i32* @A
|
||||
|
||||
store int 123, int* %B ; Store cannot alias %A
|
||||
store i32 123, i32* @B ; Store cannot alias @A
|
||||
|
||||
%A2 = load int* %A
|
||||
%X = sub int %A1, %A2
|
||||
ret int %X
|
||||
%A2 = load i32* @A
|
||||
%X = sub i32 %A1, %A2
|
||||
ret i32 %X
|
||||
}
|
||||
|
||||
int %test2() {
|
||||
%A1 = load int* %A
|
||||
define i32 @test2() {
|
||||
%A1 = load i32* @A
|
||||
br label %Loop
|
||||
Loop:
|
||||
%AP = phi int [0, %0], [%X, %Loop]
|
||||
store int %AP, int* %B ; Store cannot alias %A
|
||||
%AP = phi i32 [0, %0], [%X, %Loop]
|
||||
store i32 %AP, i32* @B ; Store cannot alias @A
|
||||
|
||||
%A2 = load int* %A
|
||||
%X = sub int %A1, %A2
|
||||
%c = seteq int %X, 0
|
||||
br bool %c, label %out, label %Loop
|
||||
%A2 = load i32* @A
|
||||
%X = sub i32 %A1, %A2
|
||||
%c = icmp eq i32 %X, 0
|
||||
br i1 %c, label %out, label %Loop
|
||||
|
||||
out:
|
||||
ret int %X
|
||||
ret i32 %X
|
||||
}
|
||||
|
||||
declare void %external()
|
||||
declare void @external()
|
||||
|
||||
int %test3() {
|
||||
%X = alloca int
|
||||
store int 7, int* %X
|
||||
call void %external()
|
||||
%V = load int* %X
|
||||
ret int %V
|
||||
define i32 @test3() {
|
||||
%X = alloca i32
|
||||
store i32 7, i32* %X
|
||||
call void @external()
|
||||
%V = load i32* %X
|
||||
ret i32 %V
|
||||
}
|
||||
|
||||
|
@ -1,17 +1,15 @@
|
||||
; A store or load cannot alias a global if the accessed amount is larger then
|
||||
; the global.
|
||||
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep load
|
||||
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep load
|
||||
|
||||
%B = global short 8
|
||||
@B = global i16 8 ; <i16*> [#uses=2]
|
||||
|
||||
implementation
|
||||
|
||||
short %test(int *%P) {
|
||||
%X = load short* %B
|
||||
store int 7, int* %P
|
||||
%Y = load short* %B
|
||||
%Z = sub short %Y, %X
|
||||
ret short %Z
|
||||
define i16 @test(i32* %P) {
|
||||
%X = load i16* @B ; <i16> [#uses=1]
|
||||
store i32 7, i32* %P
|
||||
%Y = load i16* @B ; <i16> [#uses=1]
|
||||
%Z = sub i16 %Y, %X ; <i16> [#uses=1]
|
||||
ret i16 %Z
|
||||
}
|
||||
|
||||
|
@ -3,40 +3,40 @@
|
||||
; two pointers, then the load should be hoisted, and the store sunk. Thus
|
||||
; the loop becomes empty and can be deleted by ADCE.
|
||||
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -licm --adce | llvm-dis | not grep Loop
|
||||
; RUN: llvm-as < %s | opt -basicaa -licm --adce | llvm-dis | not grep Loop
|
||||
|
||||
%A = global int 7
|
||||
%B = global int 8
|
||||
%C = global [2 x int ] [ int 4, int 8 ]
|
||||
implementation
|
||||
@A = global i32 7 ; <i32*> [#uses=3]
|
||||
@B = global i32 8 ; <i32*> [#uses=2]
|
||||
@C = global [2 x i32] [ i32 4, i32 8 ] ; <[2 x i32]*> [#uses=2]
|
||||
|
||||
int %test(bool %c) {
|
||||
%Atmp = load int* %A
|
||||
define i32 @test(i1 %c) {
|
||||
%Atmp = load i32* @A ; <i32> [#uses=2]
|
||||
br label %Loop
|
||||
Loop:
|
||||
%ToRemove = load int* %A
|
||||
store int %Atmp, int* %B ; Store cannot alias %A
|
||||
|
||||
br bool %c, label %Out, label %Loop
|
||||
Out:
|
||||
%X = sub int %ToRemove, %Atmp
|
||||
ret int %X
|
||||
Loop: ; preds = %Loop, %0
|
||||
%ToRemove = load i32* @A ; <i32> [#uses=1]
|
||||
store i32 %Atmp, i32* @B
|
||||
br i1 %c, label %Out, label %Loop
|
||||
|
||||
Out: ; preds = %Loop
|
||||
%X = sub i32 %ToRemove, %Atmp ; <i32> [#uses=1]
|
||||
ret i32 %X
|
||||
}
|
||||
|
||||
int %test2(bool %c) {
|
||||
define i32 @test2(i1 %c) {
|
||||
br label %Loop
|
||||
Loop:
|
||||
%AVal = load int* %A
|
||||
%C0 = getelementptr [2 x int ]* %C, long 0, long 0
|
||||
store int %AVal, int* %C0 ; Store cannot alias %A
|
||||
|
||||
%BVal = load int* %B
|
||||
%C1 = getelementptr [2 x int ]* %C, long 0, long 1
|
||||
store int %BVal, int* %C1 ; Store cannot alias %A, %B, or %C0
|
||||
Loop: ; preds = %Loop, %0
|
||||
%AVal = load i32* @A ; <i32> [#uses=2]
|
||||
%C0 = getelementptr [2 x i32]* @C, i64 0, i64 0 ; <i32*> [#uses=1]
|
||||
store i32 %AVal, i32* %C0
|
||||
%BVal = load i32* @B ; <i32> [#uses=2]
|
||||
%C1 = getelementptr [2 x i32]* @C, i64 0, i64 1 ; <i32*> [#uses=1]
|
||||
store i32 %BVal, i32* %C1
|
||||
br i1 %c, label %Out, label %Loop
|
||||
|
||||
br bool %c, label %Out, label %Loop
|
||||
Out:
|
||||
%X = sub int %AVal, %BVal
|
||||
ret int %X
|
||||
Out: ; preds = %Loop
|
||||
%X = sub i32 %AVal, %BVal ; <i32> [#uses=1]
|
||||
ret i32 %X
|
||||
}
|
||||
|
||||
|
@ -1,16 +1,15 @@
|
||||
; A very rudimentary test on AliasAnalysis::getModRefInfo.
|
||||
; RUN: llvm-upgrade < %s | llvm-as | \
|
||||
; RUN: opt -print-all-alias-modref-info -aa-eval -disable-output |& \
|
||||
; RUN: llvm-as < %s | opt -print-all-alias-modref-info -aa-eval -disable-output |& \
|
||||
; RUN: not grep NoModRef
|
||||
|
||||
int %callee() {
|
||||
%X = alloca { int, int }
|
||||
%Y = getelementptr { int, int }* %X, uint 0, uint 0
|
||||
%Z = load int* %Y
|
||||
ret int %Z
|
||||
define i32 @callee() {
|
||||
%X = alloca { i32, i32 } ; <{ i32, i32 }*> [#uses=1]
|
||||
%Y = getelementptr { i32, i32 }* %X, i64 0, i32 0 ; <i32*> [#uses=1]
|
||||
%Z = load i32* %Y ; <i32> [#uses=1]
|
||||
ret i32 %Z
|
||||
}
|
||||
|
||||
int %caller() {
|
||||
%X = call int %callee()
|
||||
ret int %X
|
||||
define i32 @caller() {
|
||||
%X = call i32 @callee( ) ; <i32> [#uses=1]
|
||||
ret i32 %X
|
||||
}
|
||||
|
@ -1,17 +1,16 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -load-vn -gcse -instcombine |\
|
||||
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine |\
|
||||
; RUN: llvm-dis | grep {ret i32 0}
|
||||
declare void %foo(int*)
|
||||
declare void %bar()
|
||||
|
||||
int %test() {
|
||||
%A = alloca int
|
||||
call void %foo(int* %A)
|
||||
declare void @foo(i32*)
|
||||
|
||||
%X = load int* %A
|
||||
tail call void %bar() ;; Cannot modify *%A because it's on the stack.
|
||||
%Y = load int* %A
|
||||
%Z = sub int %X, %Y
|
||||
ret int %Z
|
||||
declare void @bar()
|
||||
|
||||
define i32 @test() {
|
||||
%A = alloca i32 ; <i32*> [#uses=3]
|
||||
call void @foo( i32* %A )
|
||||
%X = load i32* %A ; <i32> [#uses=1]
|
||||
tail call void @bar( )
|
||||
%Y = load i32* %A ; <i32> [#uses=1]
|
||||
%Z = sub i32 %X, %Y ; <i32> [#uses=1]
|
||||
ret i32 %Z
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,102 +1,97 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -analyze -postdomfrontier \
|
||||
; RUN: llvm-as < %s | opt -analyze -postdomfrontier \
|
||||
; RUN: -disable-verify
|
||||
; END.
|
||||
;
|
||||
; ModuleID = '2006-09-26-PostDominanceFrontier.bc'
|
||||
target endian = little
|
||||
target pointersize = 64
|
||||
target datalayout = "e-p:64:64"
|
||||
target triple = "alphaev67-unknown-linux-gnu"
|
||||
%struct.FILE = type { int, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, sbyte*, %struct._IO_marker*, %struct.FILE*, int, int, long, ushort, sbyte, [1 x sbyte], sbyte*, long, sbyte*, sbyte*, int, [44 x sbyte] }
|
||||
%struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, int }
|
||||
%TOP = external global ulong* ; <ulong**> [#uses=1]
|
||||
%BOT = external global ulong* ; <ulong**> [#uses=1]
|
||||
%str = external global [2 x sbyte] ; <[2 x sbyte]*> [#uses=0]
|
||||
%struct.FILE = type { i32, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, i8*, %struct._IO_marker*, %struct.FILE*, i32, i32, i64, i16, i8, [1 x i8], i8*, i64, i8*, i8*, i32, [44 x i8] }
|
||||
%struct._IO_marker = type { %struct._IO_marker*, %struct.FILE*, i32 }
|
||||
@TOP = external global i64* ; <i64**> [#uses=1]
|
||||
@BOT = external global i64* ; <i64**> [#uses=1]
|
||||
@str = external global [2 x i8] ; <[2 x i8]*> [#uses=0]
|
||||
|
||||
implementation ; Functions:
|
||||
declare void @fopen()
|
||||
|
||||
declare void %fopen()
|
||||
|
||||
void %main(sbyte** %argv) {
|
||||
define void @main(i8** %argv) {
|
||||
entry:
|
||||
%netSelect.i507 = alloca ulong, align 8 ; <ulong*> [#uses=0]
|
||||
%topStart.i = alloca ulong, align 8 ; <ulong*> [#uses=0]
|
||||
%topEnd.i = alloca ulong, align 8 ; <ulong*> [#uses=0]
|
||||
%botStart.i = alloca ulong, align 8 ; <ulong*> [#uses=0]
|
||||
%botEnd.i = alloca ulong, align 8 ; <ulong*> [#uses=0]
|
||||
%c1.i154 = alloca uint, align 4 ; <uint*> [#uses=0]
|
||||
%b1.i155 = alloca uint, align 4 ; <uint*> [#uses=0]
|
||||
%t1.i156 = alloca uint, align 4 ; <uint*> [#uses=0]
|
||||
%c1.i = alloca uint, align 4 ; <uint*> [#uses=0]
|
||||
%b1.i = alloca uint, align 4 ; <uint*> [#uses=0]
|
||||
%t1.i = alloca uint, align 4 ; <uint*> [#uses=0]
|
||||
%netSelect.i5 = alloca ulong, align 8 ; <ulong*> [#uses=0]
|
||||
%netSelect.i = alloca ulong, align 8 ; <ulong*> [#uses=0]
|
||||
%tmp2.i = getelementptr sbyte** %argv, int 1 ; <sbyte**> [#uses=1]
|
||||
%tmp3.i4 = load sbyte** %tmp2.i ; <sbyte*> [#uses=0]
|
||||
call void %fopen( )
|
||||
br bool false, label %DimensionChannel.exit, label %bb.backedge.i
|
||||
%netSelect.i507 = alloca i64, align 8 ; <i64*> [#uses=0]
|
||||
%topStart.i = alloca i64, align 8 ; <i64*> [#uses=0]
|
||||
%topEnd.i = alloca i64, align 8 ; <i64*> [#uses=0]
|
||||
%botStart.i = alloca i64, align 8 ; <i64*> [#uses=0]
|
||||
%botEnd.i = alloca i64, align 8 ; <i64*> [#uses=0]
|
||||
%c1.i154 = alloca i32, align 4 ; <i32*> [#uses=0]
|
||||
%b1.i155 = alloca i32, align 4 ; <i32*> [#uses=0]
|
||||
%t1.i156 = alloca i32, align 4 ; <i32*> [#uses=0]
|
||||
%c1.i = alloca i32, align 4 ; <i32*> [#uses=0]
|
||||
%b1.i = alloca i32, align 4 ; <i32*> [#uses=0]
|
||||
%t1.i = alloca i32, align 4 ; <i32*> [#uses=0]
|
||||
%netSelect.i5 = alloca i64, align 8 ; <i64*> [#uses=0]
|
||||
%netSelect.i = alloca i64, align 8 ; <i64*> [#uses=0]
|
||||
%tmp2.i = getelementptr i8** %argv, i32 1 ; <i8**> [#uses=1]
|
||||
%tmp3.i4 = load i8** %tmp2.i ; <i8*> [#uses=0]
|
||||
call void @fopen( )
|
||||
br i1 false, label %DimensionChannel.exit, label %bb.backedge.i
|
||||
|
||||
bb.backedge.i: ; preds = %entry
|
||||
ret void
|
||||
|
||||
DimensionChannel.exit: ; preds = %entry
|
||||
%tmp13.i137 = malloc ulong, uint 0 ; <ulong*> [#uses=1]
|
||||
%tmp610.i = malloc ulong, uint 0 ; <ulong*> [#uses=1]
|
||||
%tmp13.i137 = malloc i64, i32 0 ; <i64*> [#uses=1]
|
||||
%tmp610.i = malloc i64, i32 0 ; <i64*> [#uses=1]
|
||||
br label %cond_true.i143
|
||||
|
||||
cond_true.i143: ; preds = %cond_true.i143, %DimensionChannel.exit
|
||||
%tmp9.i140 = getelementptr ulong* %tmp13.i137, ulong 0 ; <ulong*> [#uses=0]
|
||||
%tmp12.i = getelementptr ulong* %tmp610.i, ulong 0 ; <ulong*> [#uses=0]
|
||||
br bool false, label %bb18.i144, label %cond_true.i143
|
||||
%tmp9.i140 = getelementptr i64* %tmp13.i137, i64 0 ; <i64*> [#uses=0]
|
||||
%tmp12.i = getelementptr i64* %tmp610.i, i64 0 ; <i64*> [#uses=0]
|
||||
br i1 false, label %bb18.i144, label %cond_true.i143
|
||||
|
||||
bb18.i144: ; preds = %cond_true.i143
|
||||
call void %fopen( )
|
||||
%tmp76.i105 = malloc ulong, uint 0 ; <ulong*> [#uses=3]
|
||||
%tmp674.i = malloc ulong, uint 0 ; <ulong*> [#uses=2]
|
||||
%tmp1072.i = malloc ulong, uint 0 ; <ulong*> [#uses=2]
|
||||
%tmp1470.i = malloc ulong, uint 0 ; <ulong*> [#uses=1]
|
||||
call void @fopen( )
|
||||
%tmp76.i105 = malloc i64, i32 0 ; <i64*> [#uses=3]
|
||||
%tmp674.i = malloc i64, i32 0 ; <i64*> [#uses=2]
|
||||
%tmp1072.i = malloc i64, i32 0 ; <i64*> [#uses=2]
|
||||
%tmp1470.i = malloc i64, i32 0 ; <i64*> [#uses=1]
|
||||
br label %cond_true.i114
|
||||
|
||||
cond_true.i114: ; preds = %cond_true.i114, %bb18.i144
|
||||
%tmp17.i108 = getelementptr ulong* %tmp76.i105, ulong 0 ; <ulong*> [#uses=0]
|
||||
%tmp20.i = getelementptr ulong* %tmp674.i, ulong 0 ; <ulong*> [#uses=0]
|
||||
%tmp23.i111 = getelementptr ulong* %tmp1470.i, ulong 0 ; <ulong*> [#uses=0]
|
||||
br bool false, label %cond_true40.i, label %cond_true.i114
|
||||
%tmp17.i108 = getelementptr i64* %tmp76.i105, i64 0 ; <i64*> [#uses=0]
|
||||
%tmp20.i = getelementptr i64* %tmp674.i, i64 0 ; <i64*> [#uses=0]
|
||||
%tmp23.i111 = getelementptr i64* %tmp1470.i, i64 0 ; <i64*> [#uses=0]
|
||||
br i1 false, label %cond_true40.i, label %cond_true.i114
|
||||
|
||||
cond_true40.i: ; preds = %cond_true40.i, %cond_true.i114
|
||||
%tmp33.i115 = getelementptr ulong* %tmp1072.i, ulong 0 ; <ulong*> [#uses=0]
|
||||
br bool false, label %bb142.i, label %cond_true40.i
|
||||
%tmp33.i115 = getelementptr i64* %tmp1072.i, i64 0 ; <i64*> [#uses=0]
|
||||
br i1 false, label %bb142.i, label %cond_true40.i
|
||||
|
||||
cond_next54.i: ; preds = %cond_true76.i
|
||||
%tmp57.i = getelementptr ulong* %tmp55.i, ulong 0 ; <ulong*> [#uses=0]
|
||||
br bool false, label %bb64.i, label %bb69.i
|
||||
%tmp57.i = getelementptr i64* %tmp55.i, i64 0 ; <i64*> [#uses=0]
|
||||
br i1 false, label %bb64.i, label %bb69.i
|
||||
|
||||
bb64.i: ; preds = %cond_true76.i, %cond_next54.i
|
||||
%tmp67.i117 = getelementptr ulong* %tmp76.i105, ulong 0 ; <ulong*> [#uses=0]
|
||||
br bool false, label %bb114.i, label %cond_true111.i
|
||||
%tmp67.i117 = getelementptr i64* %tmp76.i105, i64 0 ; <i64*> [#uses=0]
|
||||
br i1 false, label %bb114.i, label %cond_true111.i
|
||||
|
||||
bb69.i: ; preds = %cond_next54.i
|
||||
br bool false, label %bb79.i, label %cond_true76.i
|
||||
br i1 false, label %bb79.i, label %cond_true76.i
|
||||
|
||||
cond_true76.i: ; preds = %bb142.i, %bb69.i
|
||||
%tmp48.i = getelementptr ulong* %tmp46.i, ulong 0 ; <ulong*> [#uses=0]
|
||||
br bool false, label %bb64.i, label %cond_next54.i
|
||||
%tmp48.i = getelementptr i64* %tmp46.i, i64 0 ; <i64*> [#uses=0]
|
||||
br i1 false, label %bb64.i, label %cond_next54.i
|
||||
|
||||
bb79.i: ; preds = %bb69.i
|
||||
br bool false, label %bb114.i, label %cond_true111.i
|
||||
br i1 false, label %bb114.i, label %cond_true111.i
|
||||
|
||||
cond_true111.i: ; preds = %bb79.i, %bb64.i
|
||||
%tmp84.i127 = getelementptr ulong* %tmp46.i, ulong 0 ; <ulong*> [#uses=0]
|
||||
%tmp84.i127 = getelementptr i64* %tmp46.i, i64 0 ; <i64*> [#uses=0]
|
||||
ret void
|
||||
|
||||
bb114.i: ; preds = %bb142.i, %bb79.i, %bb64.i
|
||||
%tmp117.i = getelementptr ulong* %tmp76.i105, ulong 0 ; <ulong*> [#uses=0]
|
||||
%tmp132.i131 = getelementptr ulong* %tmp674.i, ulong 0 ; <ulong*> [#uses=0]
|
||||
%tmp122.i = getelementptr ulong* %tmp1072.i, ulong 0 ; <ulong*> [#uses=0]
|
||||
%tmp117.i = getelementptr i64* %tmp76.i105, i64 0 ; <i64*> [#uses=0]
|
||||
%tmp132.i131 = getelementptr i64* %tmp674.i, i64 0 ; <i64*> [#uses=0]
|
||||
%tmp122.i = getelementptr i64* %tmp1072.i, i64 0 ; <i64*> [#uses=0]
|
||||
ret void
|
||||
|
||||
bb142.i: ; preds = %cond_true40.i
|
||||
%tmp46.i = load ulong** %BOT ; <ulong*> [#uses=2]
|
||||
%tmp55.i = load ulong** %TOP ; <ulong*> [#uses=1]
|
||||
br bool false, label %bb114.i, label %cond_true76.i
|
||||
%tmp46.i = load i64** @BOT ; <i64*> [#uses=2]
|
||||
%tmp55.i = load i64** @TOP ; <i64*> [#uses=1]
|
||||
br i1 false, label %bb114.i, label %cond_true76.i
|
||||
}
|
||||
|
@ -1,21 +1,20 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -domtree -break-crit-edges -analyze \
|
||||
; RUN: llvm-as < %s | opt -domtree -break-crit-edges -analyze \
|
||||
; RUN: -domtree | grep {3.*%brtrue }
|
||||
; PR932
|
||||
implementation ; Functions:
|
||||
|
||||
declare void %use1(int)
|
||||
declare void @use1(i32)
|
||||
|
||||
void %f(int %i, bool %c) {
|
||||
define void @f(i32 %i, i1 %c) {
|
||||
entry:
|
||||
%A = seteq int %i, 0 ; <bool> [#uses=1]
|
||||
br bool %A, label %brtrue, label %brfalse
|
||||
%A = icmp eq i32 %i, 0 ; <i1> [#uses=1]
|
||||
br i1 %A, label %brtrue, label %brfalse
|
||||
|
||||
brtrue: ; preds = %brtrue, %entry
|
||||
%B = phi bool [ true, %brtrue ], [ false, %entry ] ; <bool> [#uses=1]
|
||||
call void %use1( int %i )
|
||||
br bool %B, label %brtrue, label %brfalse
|
||||
%B = phi i1 [ true, %brtrue ], [ false, %entry ] ; <i1> [#uses=1]
|
||||
call void @use1( i32 %i )
|
||||
br i1 %B, label %brtrue, label %brfalse
|
||||
|
||||
brfalse: ; preds = %brtrue, %entry
|
||||
call void %use1( int %i )
|
||||
call void @use1( i32 %i )
|
||||
ret void
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -postdomfrontier -disable-output
|
||||
; RUN: llvm-as < %s | opt -postdomfrontier -disable-output
|
||||
|
||||
void @SManager() {
|
||||
define void @SManager() {
|
||||
entry:
|
||||
br label %bb.outer
|
||||
|
||||
@ -590,7 +590,7 @@ bb442: ; preds = %bb442.outer, %bb442.backedge
|
||||
br i1 false, label %bb420, label %bb.loopexit
|
||||
}
|
||||
|
||||
void @Invalidate() {
|
||||
define void @Invalidate() {
|
||||
entry:
|
||||
br i1 false, label %cond_false, label %cond_true
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -postdomfrontier -disable-output
|
||||
; RUN: llvm-as < %s | opt -postdomfrontier -disable-output
|
||||
|
||||
void @args_out_of_range() {
|
||||
define void @args_out_of_range() {
|
||||
entry:
|
||||
br label %bb
|
||||
|
||||
@ -8,7 +8,7 @@ bb: ; preds = %bb, %entry
|
||||
br label %bb
|
||||
}
|
||||
|
||||
void @args_out_of_range_3() {
|
||||
define void @args_out_of_range_3() {
|
||||
entry:
|
||||
br label %bb
|
||||
|
||||
@ -16,7 +16,7 @@ bb: ; preds = %bb, %entry
|
||||
br label %bb
|
||||
}
|
||||
|
||||
void @Feq() {
|
||||
define void @Feq() {
|
||||
entry:
|
||||
br i1 false, label %cond_true, label %cond_next
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load
|
||||
%X = internal global int 4
|
||||
; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load
|
||||
@X = internal global i32 4 ; <i32*> [#uses=1]
|
||||
|
||||
int %test(int *%P) {
|
||||
store int 7, int* %P
|
||||
store int 12, int* %X ;; cannot alias P, X's addr isn't taken
|
||||
%V = load int* %P
|
||||
ret int %V
|
||||
define i32 @test(i32* %P) {
|
||||
store i32 7, i32* %P
|
||||
store i32 12, i32* @X
|
||||
%V = load i32* %P ; <i32> [#uses=1]
|
||||
ret i32 %V
|
||||
}
|
||||
|
@ -1,26 +1,20 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | \
|
||||
; RUN: opt -globalsmodref-aa -load-vn -gcse -instcombine | llvm-dis | \
|
||||
; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse -instcombine | llvm-dis | \
|
||||
; RUN: grep {ret i32 0}
|
||||
; END.
|
||||
%G = internal global int* null
|
||||
|
||||
implementation
|
||||
@G = internal global i32* null ; <i32**> [#uses=3]
|
||||
|
||||
void %test() {
|
||||
%A = malloc int
|
||||
store int* %A, int** %G
|
||||
define void @test() {
|
||||
%A = malloc i32 ; <i32*> [#uses=1]
|
||||
store i32* %A, i32** @G
|
||||
ret void
|
||||
}
|
||||
|
||||
int %test1(int *%P) {
|
||||
%g1 = load int** %G
|
||||
%h1 = load int* %g1
|
||||
|
||||
; This store cannot alias either G or g1.
|
||||
store int 123, int* %P
|
||||
|
||||
%g2 = load int** %G
|
||||
%h2 = load int* %g1
|
||||
%X = sub int %h1, %h2 ;; -> 0
|
||||
ret int %X
|
||||
define i32 @test1(i32* %P) {
|
||||
%g1 = load i32** @G ; <i32*> [#uses=2]
|
||||
%h1 = load i32* %g1 ; <i32> [#uses=1]
|
||||
store i32 123, i32* %P
|
||||
%g2 = load i32** @G ; <i32*> [#uses=0]
|
||||
%h2 = load i32* %g1 ; <i32> [#uses=1]
|
||||
%X = sub i32 %h1, %h2 ; <i32> [#uses=1]
|
||||
ret i32 %X
|
||||
}
|
||||
|
@ -1,13 +1,13 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load
|
||||
%X = internal global int 4
|
||||
; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse | llvm-dis | not grep load
|
||||
@X = internal global i32 4 ; <i32*> [#uses=2]
|
||||
|
||||
int %test(int *%P) {
|
||||
store int 12, int* %X
|
||||
call void %doesnotmodX()
|
||||
%V = load int* %X
|
||||
ret int %V
|
||||
define i32 @test(i32* %P) {
|
||||
store i32 12, i32* @X
|
||||
call void @doesnotmodX( )
|
||||
%V = load i32* @X ; <i32> [#uses=1]
|
||||
ret i32 %V
|
||||
}
|
||||
|
||||
void %doesnotmodX() {
|
||||
define void @doesnotmodX() {
|
||||
ret void
|
||||
}
|
||||
|
@ -1,23 +1,23 @@
|
||||
; Test that pure functions are cse'd away
|
||||
; RUN: llvm-as < %s | opt -globalsmodref-aa -load-vn -gcse -instcombine | \
|
||||
; RUN: llvm-dis | not grep sub
|
||||
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -globalsmodref-aa -load-vn -gcse -instcombine | llvm-dis | not grep sub
|
||||
|
||||
int %pure(int %X) {
|
||||
%Y = add int %X, 1
|
||||
ret int %Y
|
||||
define i32 @pure(i32 %X) {
|
||||
%Y = add i32 %X, 1 ; <i32> [#uses=1]
|
||||
ret i32 %Y
|
||||
}
|
||||
|
||||
int %test1(int %X) {
|
||||
%A = call int %pure(int %X)
|
||||
%B = call int %pure(int %X)
|
||||
%C = sub int %A, %B
|
||||
ret int %C
|
||||
define i32 @test1(i32 %X) {
|
||||
%A = call i32 @pure( i32 %X ) ; <i32> [#uses=1]
|
||||
%B = call i32 @pure( i32 %X ) ; <i32> [#uses=1]
|
||||
%C = sub i32 %A, %B ; <i32> [#uses=1]
|
||||
ret i32 %C
|
||||
}
|
||||
|
||||
int %test2(int %X, int* %P) {
|
||||
%A = call int %pure(int %X)
|
||||
store int %X, int* %P ;; Does not invalidate 'pure' call.
|
||||
%B = call int %pure(int %X)
|
||||
%C = sub int %A, %B
|
||||
ret int %C
|
||||
define i32 @test2(i32 %X, i32* %P) {
|
||||
%A = call i32 @pure( i32 %X ) ; <i32> [#uses=1]
|
||||
store i32 %X, i32* %P ;; Does not invalidate 'pure' call.
|
||||
%B = call i32 @pure( i32 %X ) ; <i32> [#uses=1]
|
||||
%C = sub i32 %A, %B ; <i32> [#uses=1]
|
||||
ret i32 %C
|
||||
}
|
||||
|
@ -1,23 +1,25 @@
|
||||
; This testcase ensures that redundant loads are eliminated when they should
|
||||
; be. All RL variables (redundant loads) should be eliminated.
|
||||
;
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse | llvm-dis | not grep %RL
|
||||
; RUN: llvm-as < %s | opt -load-vn -gcse | llvm-dis | not grep %RL
|
||||
;
|
||||
int "test1"(int* %P) {
|
||||
%A = load int* %P
|
||||
%RL = load int* %P
|
||||
%C = add int %A, %RL
|
||||
ret int %C
|
||||
|
||||
define i32 @test1(i32* %P) {
|
||||
%A = load i32* %P ; <i32> [#uses=1]
|
||||
%RL = load i32* %P ; <i32> [#uses=1]
|
||||
%C = add i32 %A, %RL ; <i32> [#uses=1]
|
||||
ret i32 %C
|
||||
}
|
||||
|
||||
int "test2"(int* %P) {
|
||||
%A = load int* %P
|
||||
define i32 @test2(i32* %P) {
|
||||
%A = load i32* %P ; <i32> [#uses=1]
|
||||
br label %BB2
|
||||
BB2:
|
||||
br label %BB3
|
||||
BB3:
|
||||
%RL = load int* %P
|
||||
%B = add int %A, %RL
|
||||
ret int %B
|
||||
}
|
||||
|
||||
BB2: ; preds = %0
|
||||
br label %BB3
|
||||
|
||||
BB3: ; preds = %BB2
|
||||
%RL = load i32* %P ; <i32> [#uses=1]
|
||||
%B = add i32 %A, %RL ; <i32> [#uses=1]
|
||||
ret i32 %B
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
; RUN: llvm-as < %s | opt -load-vn -gcse -instcombine | llvm-dis | grep sub
|
||||
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse -instcombine | llvm-dis | grep sub
|
||||
|
||||
int %test(int* %P) {
|
||||
%X = volatile load int* %P
|
||||
%Y = volatile load int* %P
|
||||
%Z = sub int %X, %Y
|
||||
ret int %Z
|
||||
define i32 @test(i32* %P) {
|
||||
%X = volatile load i32* %P ; <i32> [#uses=1]
|
||||
%Y = volatile load i32* %P ; <i32> [#uses=1]
|
||||
%Z = sub i32 %X, %Y ; <i32> [#uses=1]
|
||||
ret i32 %Z
|
||||
}
|
||||
|
@ -1,25 +1,26 @@
|
||||
; This testcase ensures that redundant loads are preserved when they are not
|
||||
; allowed to be eliminated.
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse | llvm-dis | grep sub
|
||||
; RUN: llvm-as < %s | opt -load-vn -gcse | llvm-dis | grep sub
|
||||
;
|
||||
int %test1(int* %P) {
|
||||
%A = load int* %P
|
||||
store int 1, int* %P
|
||||
%B = load int* %P
|
||||
%C = sub int %A, %B
|
||||
ret int %C
|
||||
|
||||
define i32 @test1(i32* %P) {
|
||||
%A = load i32* %P ; <i32> [#uses=1]
|
||||
store i32 1, i32* %P
|
||||
%B = load i32* %P ; <i32> [#uses=1]
|
||||
%C = sub i32 %A, %B ; <i32> [#uses=1]
|
||||
ret i32 %C
|
||||
}
|
||||
|
||||
int %test2(int* %P) {
|
||||
%A = load int* %P
|
||||
define i32 @test2(i32* %P) {
|
||||
%A = load i32* %P ; <i32> [#uses=1]
|
||||
br label %BB2
|
||||
BB2:
|
||||
store int 5, int* %P
|
||||
|
||||
BB2: ; preds = %0
|
||||
store i32 5, i32* %P
|
||||
br label %BB3
|
||||
BB3:
|
||||
%B = load int* %P
|
||||
%C = sub int %A, %B
|
||||
ret int %C
|
||||
|
||||
BB3: ; preds = %BB2
|
||||
%B = load i32* %P ; <i32> [#uses=1]
|
||||
%C = sub i32 %A, %B ; <i32> [#uses=1]
|
||||
ret i32 %C
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,13 +1,13 @@
|
||||
; Check to make sure that Value Numbering doesn't merge casts of different
|
||||
; flavors.
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse | llvm-dis | \
|
||||
; RUN: llvm-as < %s | opt -load-vn -gcse | llvm-dis | \
|
||||
; RUN: grep {\[sz\]ext} | count 2
|
||||
|
||||
declare void %external(int)
|
||||
declare void @external(i32)
|
||||
|
||||
int %test_casts(short %x) {
|
||||
%a = sext short %x to int
|
||||
%b = zext short %x to int
|
||||
call void %external(int %a)
|
||||
ret int %b
|
||||
define i32 @test_casts(i16 %x) {
|
||||
%a = sext i16 %x to i32 ; <i32> [#uses=1]
|
||||
%b = zext i16 %x to i32 ; <i32> [#uses=1]
|
||||
call void @external( i32 %a )
|
||||
ret i32 %b
|
||||
}
|
||||
|
@ -1,27 +1,25 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -basicaa -load-vn -gcse -instcombine | llvm-dis | not grep sub
|
||||
; RUN: llvm-as < %s | opt -basicaa -load-vn -gcse -instcombine | \
|
||||
; RUN: llvm-dis | not grep sub
|
||||
|
||||
%S = type { int, sbyte }
|
||||
%S = type { i32, i8 }
|
||||
|
||||
sbyte %test(sbyte** %P) {
|
||||
%A = load sbyte** %P
|
||||
%B = load sbyte* %A
|
||||
|
||||
%X = load sbyte** %P
|
||||
%Y = load sbyte* %X
|
||||
|
||||
%R = sub sbyte %B, %Y
|
||||
ret sbyte %R
|
||||
define i8 @test(i8** %P) {
|
||||
%A = load i8** %P ; <i8*> [#uses=1]
|
||||
%B = load i8* %A ; <i8> [#uses=1]
|
||||
%X = load i8** %P ; <i8*> [#uses=1]
|
||||
%Y = load i8* %X ; <i8> [#uses=1]
|
||||
%R = sub i8 %B, %Y ; <i8> [#uses=1]
|
||||
ret i8 %R
|
||||
}
|
||||
|
||||
sbyte %test(%S ** %P) {
|
||||
%A = load %S** %P
|
||||
%B = getelementptr %S* %A, int 0, uint 1
|
||||
%C = load sbyte* %B
|
||||
|
||||
%X = load %S** %P
|
||||
%Y = getelementptr %S* %X, int 0, uint 1
|
||||
%Z = load sbyte* %Y
|
||||
|
||||
%R = sub sbyte %C, %Z
|
||||
ret sbyte %R
|
||||
define i8 @test1(%S** %P) {
|
||||
%A = load %S** %P ; <%S*> [#uses=1]
|
||||
%B = getelementptr %S* %A, i32 0, i32 1 ; <i8*> [#uses=1]
|
||||
%C = load i8* %B ; <i8> [#uses=1]
|
||||
%X = load %S** %P ; <%S*> [#uses=1]
|
||||
%Y = getelementptr %S* %X, i32 0, i32 1 ; <i8*> [#uses=1]
|
||||
%Z = load i8* %Y ; <i8> [#uses=1]
|
||||
%R = sub i8 %C, %Z ; <i8> [#uses=1]
|
||||
ret i8 %R
|
||||
}
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -load-vn -gcse | llvm-dis | not grep load
|
||||
; RUN: llvm-as < %s | opt -load-vn -gcse | llvm-dis | not grep load
|
||||
; Test that loads of undefined memory are eliminated.
|
||||
|
||||
int %test1() {
|
||||
%X = malloc int
|
||||
%Y = load int* %X
|
||||
ret int %Y
|
||||
}
|
||||
int %test2() {
|
||||
%X = alloca int
|
||||
%Y = load int* %X
|
||||
ret int %Y
|
||||
define i32 @test1() {
|
||||
%X = malloc i32 ; <i32*> [#uses=1]
|
||||
%Y = load i32* %X ; <i32> [#uses=1]
|
||||
ret i32 %Y
|
||||
}
|
||||
|
||||
define i32 @test2() {
|
||||
%X = alloca i32 ; <i32*> [#uses=1]
|
||||
%Y = load i32* %X ; <i32> [#uses=1]
|
||||
ret i32 %Y
|
||||
}
|
||||
|
@ -1,30 +1,30 @@
|
||||
; This testcase was incorrectly computing that the loopentry.7 loop was
|
||||
; not a child of the loopentry.6 loop.
|
||||
;
|
||||
; RUN: llvm-upgrade < %s | llvm-as | opt -analyze -loops | \
|
||||
; RUN: llvm-as < %s | opt -analyze -loops | \
|
||||
; RUN: grep {^ Loop Containing: %loopentry.7}
|
||||
|
||||
void %getAndMoveToFrontDecode() { ; No predecessors!
|
||||
define void @getAndMoveToFrontDecode() {
|
||||
br label %endif.2
|
||||
|
||||
endif.2: ; preds = %0, %loopexit.5
|
||||
br bool false, label %loopentry.5, label %UnifiedExitNode
|
||||
endif.2: ; preds = %loopexit.5, %0
|
||||
br i1 false, label %loopentry.5, label %UnifiedExitNode
|
||||
|
||||
loopentry.5: ; preds = %endif.2, %loopexit.6
|
||||
br bool false, label %loopentry.6, label %UnifiedExitNode
|
||||
loopentry.5: ; preds = %loopexit.6, %endif.2
|
||||
br i1 false, label %loopentry.6, label %UnifiedExitNode
|
||||
|
||||
loopentry.6: ; preds = %loopentry.5, %loopentry.7
|
||||
br bool false, label %loopentry.7, label %loopexit.6
|
||||
loopentry.6: ; preds = %loopentry.7, %loopentry.5
|
||||
br i1 false, label %loopentry.7, label %loopexit.6
|
||||
|
||||
loopentry.7: ; preds = %loopentry.6, %loopentry.7
|
||||
br bool false, label %loopentry.7, label %loopentry.6
|
||||
loopentry.7: ; preds = %loopentry.7, %loopentry.6
|
||||
br i1 false, label %loopentry.7, label %loopentry.6
|
||||
|
||||
loopexit.6: ; preds = %loopentry.6
|
||||
br bool false, label %loopentry.5, label %loopexit.5
|
||||
br i1 false, label %loopentry.5, label %loopexit.5
|
||||
|
||||
loopexit.5: ; preds = %loopexit.6
|
||||
br bool false, label %endif.2, label %UnifiedExitNode
|
||||
br i1 false, label %endif.2, label %UnifiedExitNode
|
||||
|
||||
UnifiedExitNode: ; preds = %endif.2, %loopexit.5, %loopentry.5
|
||||
UnifiedExitNode: ; preds = %loopexit.5, %loopentry.5, %endif.2
|
||||
ret void
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user