Byebye llvm-upgrade!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48762 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Tanya Lattner 2008-03-25 04:26:08 +00:00
parent a2fb634def
commit 6f729d601c
110 changed files with 1823 additions and 2138 deletions

View File

@ -1,6 +1,7 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 ; RUN: llvm-as < %s | llc -march=ppc32
void %main() { define void @main() {
%tr4 = shl ulong 1, ubyte 0 ; <ulong> [#uses=0] %tr4 = shl i64 1, 0 ; <i64> [#uses=0]
ret void ret void
} }

View File

@ -1,7 +1,9 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 ; RUN: llvm-as < %s | llc -march=ppc32
void %main() { define void @main() {
%shamt = add ubyte 0, 1 ; <ubyte> [#uses=1] %shamt = add i8 0, 1 ; <i8> [#uses=1]
%tr2 = shr long 1, ubyte %shamt ; <long> [#uses=0] %shift.upgrd.1 = zext i8 %shamt to i64 ; <i64> [#uses=1]
ret void %tr2 = ashr i64 1, %shift.upgrd.1 ; <i64> [#uses=0]
ret void
} }

View File

@ -1,3 +1,4 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep .comm.*X,0 ; RUN: llvm-as < %s | llc -march=ppc32 | not grep .comm.*X,0
@X = linkonce global { } zeroinitializer ; <{ }*> [#uses=0]
%X = linkonce global {} {}

View File

@ -1,8 +1,8 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 ; RUN: llvm-as < %s | llc -march=ppc32
int %main() { define i32 @main() {
%setle = setle long 1, 0 %setle = icmp sle i64 1, 0 ; <i1> [#uses=1]
%select = select bool true, bool %setle, bool true %select = select i1 true, i1 %setle, i1 true ; <i1> [#uses=0]
ret int 0 ret i32 0
} }

View File

@ -1,3 +1,5 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 ; RUN: llvm-as < %s | llc -march=ppc32
long %test() { ret long undef } define i64 @test() {
ret i64 undef
}

View File

@ -1,12 +1,13 @@
; this should not crash the ppc backend ; this should not crash the ppc backend
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 ; RUN: llvm-as < %s | llc -march=ppc32
uint %test( int %j.0.0.i) {
%tmp.85.i = and int %j.0.0.i, 7 define i32 @test(i32 %j.0.0.i) {
%tmp.161278.i = cast int %tmp.85.i to uint %tmp.85.i = and i32 %j.0.0.i, 7 ; <i32> [#uses=1]
%tmp.5.i77.i = shr uint %tmp.161278.i, ubyte 3 %tmp.161278.i = bitcast i32 %tmp.85.i to i32 ; <i32> [#uses=1]
ret uint %tmp.5.i77.i %tmp.5.i77.i = lshr i32 %tmp.161278.i, 3 ; <i32> [#uses=1]
ret i32 %tmp.5.i77.i
} }

View File

@ -1,10 +1,11 @@
; This function should have exactly one call to fixdfdi, no more! ; This function should have exactly one call to fixdfdi, no more!
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mattr=-64bit | \ ; RUN: llvm-as < %s | llc -march=ppc32 -mattr=-64bit | \
; RUN: grep {bl .*fixdfdi} | count 1 ; RUN: grep {bl .*fixdfdi} | count 1
double %test2(double %tmp.7705) { define double @test2(double %tmp.7705) {
%mem_tmp.2.0.in = cast double %tmp.7705 to long ; <long> [#uses=1] %mem_tmp.2.0.in = fptosi double %tmp.7705 to i64 ; <i64> [#uses=1]
%mem_tmp.2.0 = cast long %mem_tmp.2.0.in to double %mem_tmp.2.0 = sitofp i64 %mem_tmp.2.0.in to double ; <double> [#uses=1]
ret double %mem_tmp.2.0 ret double %mem_tmp.2.0
} }

View File

@ -1,9 +1,11 @@
; This was erroneously being turned into an rlwinm instruction. ; This was erroneously being turned into an rlwinm instruction.
; The sign bit does matter in this case. ; The sign bit does matter in this case.
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep srawi ; RUN: llvm-as < %s | llc -march=ppc32 | grep srawi
int %test(int %X) {
%Y = and int %X, -2 define i32 @test(i32 %X) {
%Z = shr int %Y, ubyte 11 %Y = and i32 %X, -2 ; <i32> [#uses=1]
ret int %Z %Z = ashr i32 %Y, 11 ; <i32> [#uses=1]
ret i32 %Z
} }

View File

@ -1,17 +1,18 @@
; RUN: llvm-upgrade < %s | llvm-as | llc ; RUN: llvm-as < %s | llc
target endian = big
target pointersize = 32
target triple = "powerpc-apple-darwin8.2.0"
implementation ; Functions:
void %bar(int %G, int %E, int %F, int %A, int %B, int %C, int %D, sbyte* %fmt, ...) { target datalayout = "E-p:32:32"
%ap = alloca sbyte* ; <sbyte**> [#uses=2] target triple = "powerpc-apple-darwin8.2.0"
call void %llvm.va_start( sbyte** %ap )
%tmp.1 = load sbyte** %ap ; <sbyte*> [#uses=1] define void @bar(i32 %G, i32 %E, i32 %F, i32 %A, i32 %B, i32 %C, i32 %D, i8* %fmt, ...) {
%tmp.0 = call double %foo( sbyte* %tmp.1 ) ; <double> [#uses=0] %ap = alloca i8* ; <i8**> [#uses=2]
ret void %va.upgrd.1 = bitcast i8** %ap to i8* ; <i8*> [#uses=1]
call void @llvm.va_start( i8* %va.upgrd.1 )
%tmp.1 = load i8** %ap ; <i8*> [#uses=1]
%tmp.0 = call double @foo( i8* %tmp.1 ) ; <double> [#uses=0]
ret void
} }
declare void %llvm.va_start(sbyte**) declare void @llvm.va_start(i8*)
declare double @foo(i8*)
declare double %foo(sbyte*)

View File

@ -1,12 +1,10 @@
; RUN: llvm-upgrade < %s | llvm-as | llc | not grep {, f1} ; RUN: llvm-as < %s | llc | not grep {, f1}
target endian = big target datalayout = "E-p:32:32"
target pointersize = 32
target triple = "powerpc-apple-darwin8.2.0" target triple = "powerpc-apple-darwin8.2.0"
; Dead argument should reserve an FP register. ; Dead argument should reserve an FP register.
double %bar(double %DEAD, double %X, double %Y) { define double @bar(double %DEAD, double %X, double %Y) {
%tmp.2 = add double %X, %Y %tmp.2 = add double %X, %Y ; <double> [#uses=1]
ret double %tmp.2 ret double %tmp.2
} }

View File

@ -1,17 +1,19 @@
; RUN: llvm-upgrade < %s | llvm-as | llc ; RUN: llvm-as < %s | llc
void %iterative_hash_host_wide_int() { define void @iterative_hash_host_wide_int() {
%zero = alloca int ; <int*> [#uses=2] %zero = alloca i32 ; <i32*> [#uses=2]
%b = alloca uint ; <uint*> [#uses=1] %b = alloca i32 ; <i32*> [#uses=1]
store int 0, int* %zero store i32 0, i32* %zero
%tmp = load int* %zero ; <int> [#uses=1] %tmp = load i32* %zero ; <i32> [#uses=1]
%tmp5 = cast int %tmp to uint ; <uint> [#uses=1] %tmp5 = bitcast i32 %tmp to i32 ; <i32> [#uses=1]
%tmp6.u = add uint %tmp5, 32 ; <uint> [#uses=1] %tmp6.u = add i32 %tmp5, 32 ; <i32> [#uses=1]
%tmp6 = cast uint %tmp6.u to int ; <int> [#uses=1] %tmp6 = bitcast i32 %tmp6.u to i32 ; <i32> [#uses=1]
%tmp7 = load long* null ; <long> [#uses=1] %tmp7 = load i64* null ; <i64> [#uses=1]
%tmp6 = cast int %tmp6 to ubyte ; <ubyte> [#uses=1] %tmp6.upgrd.1 = trunc i32 %tmp6 to i8 ; <i8> [#uses=1]
%tmp8 = shr long %tmp7, ubyte %tmp6 ; <long> [#uses=1] %shift.upgrd.2 = zext i8 %tmp6.upgrd.1 to i64 ; <i64> [#uses=1]
%tmp8 = cast long %tmp8 to uint ; <uint> [#uses=1] %tmp8 = ashr i64 %tmp7, %shift.upgrd.2 ; <i64> [#uses=1]
store uint %tmp8, uint* %b %tmp8.upgrd.3 = trunc i64 %tmp8 to i32 ; <i32> [#uses=1]
unreachable store i32 %tmp8.upgrd.3, i32* %b
unreachable
} }

View File

@ -1,7 +1,9 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 ; RUN: llvm-as < %s | llc -march=ppc32
double %CalcSpeed(float %tmp127) {
%tmp145 = cast float %tmp127 to double ; <double> [#uses=1] define double @CalcSpeed(float %tmp127) {
%tmp150 = call double asm "frsqrte $0,$1", "=f,f"( double %tmp145 ) ; <double> [#uses=0] %tmp145 = fpext float %tmp127 to double ; <double> [#uses=1]
ret double %tmp150 %tmp150 = call double asm "frsqrte $0,$1", "=f,f"( double %tmp145 ) ; <double> [#uses=1]
ret double %tmp150
} }

View File

@ -1,10 +1,11 @@
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -mcpu=g5 | \ ; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -mcpu=g5 | \
; RUN: grep {vspltish v.*, 10} ; RUN: grep {vspltish v.*, 10}
void %test(<8 x short>* %P) { define void @test(<8 x i16>* %P) {
%tmp = load <8 x short>* %P ; <<8 x short>> [#uses=1] %tmp = load <8 x i16>* %P ; <<8 x i16>> [#uses=1]
%tmp1 = add <8 x short> %tmp, < short 10, short 10, short 10, short 10, short 10, short 10, short 10, short 10 > ; <<8 x short>> [#uses=1] %tmp1 = add <8 x i16> %tmp, < i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10 > ; <<8 x i16>> [#uses=1]
store <8 x short> %tmp1, <8 x short>* %P store <8 x i16> %tmp1, <8 x i16>* %P
ret void ret void
} }

View File

@ -1,72 +1,58 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g5 ; RUN: llvm-as < %s | llc -march=ppc32 -mcpu=g5
; END.
void %test(sbyte* %stack) { define void @test(i8* %stack) {
entry: entry:
%tmp9 = seteq int 0, 0 ; <bool> [#uses=1] %tmp9 = icmp eq i32 0, 0 ; <i1> [#uses=1]
%tmp30 = seteq uint 0, 0 ; <bool> [#uses=1] %tmp30 = icmp eq i32 0, 0 ; <i1> [#uses=1]
br bool %tmp30, label %cond_next54, label %cond_true31 br i1 %tmp30, label %cond_next54, label %cond_true31
cond_true860: ; preds = %bb855 cond_true860: ; preds = %bb855
%tmp879 = tail call <4 x float> %llvm.ppc.altivec.vmaddfp( <4 x float> zeroinitializer, <4 x float> zeroinitializer, <4 x float> zeroinitializer ) ; <<4 x float>> [#uses=1] %tmp879 = tail call <4 x float> @llvm.ppc.altivec.vmaddfp( <4 x float> zeroinitializer, <4 x float> zeroinitializer, <4 x float> zeroinitializer ) ; <<4 x float>> [#uses=1]
%tmp880 = cast <4 x float> %tmp879 to <4 x int> ; <<4 x int>> [#uses=2] %tmp880 = bitcast <4 x float> %tmp879 to <4 x i32> ; <<4 x i32>> [#uses=2]
%tmp883 = shufflevector <4 x int> %tmp880, <4 x int> undef, <4 x uint> < uint 1, uint 1, uint 1, uint 1 > ; <<4 x int>> [#uses=1] %tmp883 = shufflevector <4 x i32> %tmp880, <4 x i32> undef, <4 x i32> < i32 1, i32 1, i32 1, i32 1 > ; <<4 x i32>> [#uses=1]
%tmp883 = cast <4 x int> %tmp883 to <4 x float> ; <<4 x float>> [#uses=1] %tmp883.upgrd.1 = bitcast <4 x i32> %tmp883 to <4 x float> ; <<4 x float>> [#uses=1]
%tmp885 = shufflevector <4 x int> %tmp880, <4 x int> undef, <4 x uint> < uint 2, uint 2, uint 2, uint 2 > ; <<4 x int>> [#uses=1] %tmp885 = shufflevector <4 x i32> %tmp880, <4 x i32> undef, <4 x i32> < i32 2, i32 2, i32 2, i32 2 > ; <<4 x i32>> [#uses=1]
%tmp885 = cast <4 x int> %tmp885 to <4 x float> ; <<4 x float>> [#uses=1] %tmp885.upgrd.2 = bitcast <4 x i32> %tmp885 to <4 x float> ; <<4 x float>> [#uses=1]
br label %cond_next905 br label %cond_next905
cond_true31: ; preds = %entry cond_true31: ; preds = %entry
ret void ret void
cond_next54: ; preds = %entry cond_next54: ; preds = %entry
br bool %tmp9, label %cond_false385, label %bb279 br i1 %tmp9, label %cond_false385, label %bb279
bb279: ; preds = %cond_next54 bb279: ; preds = %cond_next54
ret void ret void
cond_false385: ; preds = %cond_next54 cond_false385: ; preds = %cond_next54
%tmp388 = seteq uint 0, 0 ; <bool> [#uses=1] %tmp388 = icmp eq i32 0, 0 ; <i1> [#uses=1]
br bool %tmp388, label %cond_next463, label %cond_true389 br i1 %tmp388, label %cond_next463, label %cond_true389
cond_true389: ; preds = %cond_false385 cond_true389: ; preds = %cond_false385
ret void ret void
cond_next463: ; preds = %cond_false385 cond_next463: ; preds = %cond_false385
%tmp1208107 = setgt sbyte* null, %stack ; <bool> [#uses=1] %tmp1208107 = icmp ugt i8* null, %stack ; <i1> [#uses=1]
br bool %tmp1208107, label %cond_true1209.preheader, label %bb1212 br i1 %tmp1208107, label %cond_true1209.preheader, label %bb1212
cond_true498: ; preds = %cond_true1209.preheader cond_true498: ; preds = %cond_true1209.preheader
ret void ret void
cond_true519: ; preds = %cond_true1209.preheader cond_true519: ; preds = %cond_true1209.preheader
%bothcond = or bool false, false ; <bool> [#uses=1] %bothcond = or i1 false, false ; <i1> [#uses=1]
br bool %bothcond, label %bb855, label %bb980 br i1 %bothcond, label %bb855, label %bb980
cond_false548: ; preds = %cond_true1209.preheader cond_false548: ; preds = %cond_true1209.preheader
ret void ret void
bb855: ; preds = %cond_true519 bb855: ; preds = %cond_true519
%tmp859 = seteq int 0, 0 ; <bool> [#uses=1] %tmp859 = icmp eq i32 0, 0 ; <i1> [#uses=1]
br bool %tmp859, label %cond_true860, label %cond_next905 br i1 %tmp859, label %cond_true860, label %cond_next905
cond_next905: ; preds = %bb855, %cond_true860 cond_next905: ; preds = %bb855, %cond_true860
%vfpw2.4 = phi <4 x float> [ %tmp885, %cond_true860 ], [ undef, %bb855 ] ; <<4 x float>> [#uses=0] %vfpw2.4 = phi <4 x float> [ %tmp885.upgrd.2, %cond_true860 ], [ undef, %bb855 ] ; <<4 x float>> [#uses=0]
%vfpw1.4 = phi <4 x float> [ %tmp883, %cond_true860 ], [ undef, %bb855 ] ; <<4 x float>> [#uses=0] %vfpw1.4 = phi <4 x float> [ %tmp883.upgrd.1, %cond_true860 ], [ undef, %bb855 ] ; <<4 x float>> [#uses=0]
%tmp930 = cast <4 x float> zeroinitializer to <4 x int> ; <<4 x int>> [#uses=0] %tmp930 = bitcast <4 x float> zeroinitializer to <4 x i32> ; <<4 x i32>> [#uses=0]
ret void ret void
bb980: ; preds = %cond_true519 bb980: ; preds = %cond_true519
ret void ret void
cond_true1209.preheader: ; preds = %cond_next463 cond_true1209.preheader: ; preds = %cond_next463
%tmp496 = and uint 0, 12288 ; <uint> [#uses=1] %tmp496 = and i32 0, 12288 ; <i32> [#uses=1]
switch uint %tmp496, label %cond_false548 [ switch i32 %tmp496, label %cond_false548 [
uint 0, label %cond_true498 i32 0, label %cond_true498
uint 4096, label %cond_true519 i32 4096, label %cond_true519
] ]
bb1212: ; preds = %cond_next463 bb1212: ; preds = %cond_next463
ret void ret void
} }
declare <4 x float> %llvm.ppc.altivec.vmaddfp(<4 x float>, <4 x float>, <4 x float>) declare <4 x float> @llvm.ppc.altivec.vmaddfp(<4 x float>, <4 x float>, <4 x float>)

View File

@ -1,60 +1,55 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 ; RUN: llvm-as < %s | llc -march=ppc32
; END.
%struct.attr_desc = type { sbyte*, %struct.attr_desc*, %struct.attr_value*, %struct.attr_value*, uint } %struct.attr_desc = type { i8*, %struct.attr_desc*, %struct.attr_value*, %struct.attr_value*, i32 }
%struct.attr_value = type { %struct.rtx_def*, %struct.attr_value*, %struct.insn_ent*, int, int } %struct.attr_value = type { %struct.rtx_def*, %struct.attr_value*, %struct.insn_ent*, i32, i32 }
%struct.insn_def = type { %struct.insn_def*, %struct.rtx_def*, int, int, int, int, int } %struct.insn_def = type { %struct.insn_def*, %struct.rtx_def*, i32, i32, i32, i32, i32 }
%struct.insn_ent = type { %struct.insn_ent*, %struct.insn_def* } %struct.insn_ent = type { %struct.insn_ent*, %struct.insn_def* }
%struct.rtx_def = type { ushort, ubyte, ubyte, %struct.u } %struct.rtx_def = type { i16, i8, i8, %struct.u }
%struct.u = type { [1 x long] } %struct.u = type { [1 x i64] }
implementation ; Functions: define void @find_attr() {
void %find_attr() {
entry: entry:
%tmp26 = seteq %struct.attr_desc* null, null ; <bool> [#uses=1] %tmp26 = icmp eq %struct.attr_desc* null, null ; <i1> [#uses=1]
br bool %tmp26, label %bb30, label %cond_true27 br i1 %tmp26, label %bb30, label %cond_true27
cond_true27: ; preds = %entry cond_true27: ; preds = %entry
ret void ret void
bb30: ; preds = %entry bb30: ; preds = %entry
%tmp67 = seteq %struct.attr_desc* null, null ; <bool> [#uses=1] %tmp67 = icmp eq %struct.attr_desc* null, null ; <i1> [#uses=1]
br bool %tmp67, label %cond_next92, label %cond_true68 br i1 %tmp67, label %cond_next92, label %cond_true68
cond_true68: ; preds = %bb30 cond_true68: ; preds = %bb30
ret void ret void
cond_next92: ; preds = %bb30 cond_next92: ; preds = %bb30
%tmp173 = getelementptr %struct.attr_desc* null, int 0, uint 4 ; <uint*> [#uses=2] %tmp173 = getelementptr %struct.attr_desc* null, i32 0, i32 4 ; <i32*> [#uses=2]
%tmp174 = load uint* %tmp173 ; <uint> [#uses=1] %tmp174 = load i32* %tmp173 ; <i32> [#uses=1]
%tmp177 = and uint %tmp174, 4294967287 ; <uint> [#uses=1] %tmp177 = and i32 %tmp174, -9 ; <i32> [#uses=1]
store uint %tmp177, uint* %tmp173 store i32 %tmp177, i32* %tmp173
%tmp180 = getelementptr %struct.attr_desc* null, int 0, uint 4 ; <uint*> [#uses=1] %tmp180 = getelementptr %struct.attr_desc* null, i32 0, i32 4 ; <i32*> [#uses=1]
%tmp181 = load uint* %tmp180 ; <uint> [#uses=1] %tmp181 = load i32* %tmp180 ; <i32> [#uses=1]
%tmp185 = getelementptr %struct.attr_desc* null, int 0, uint 4 ; <uint*> [#uses=2] %tmp185 = getelementptr %struct.attr_desc* null, i32 0, i32 4 ; <i32*> [#uses=2]
%tmp186 = load uint* %tmp185 ; <uint> [#uses=1] %tmp186 = load i32* %tmp185 ; <i32> [#uses=1]
%tmp183187 = shl uint %tmp181, ubyte 1 ; <uint> [#uses=1] %tmp183187 = shl i32 %tmp181, 1 ; <i32> [#uses=1]
%tmp188 = and uint %tmp183187, 16 ; <uint> [#uses=1] %tmp188 = and i32 %tmp183187, 16 ; <i32> [#uses=1]
%tmp190 = and uint %tmp186, 4294967279 ; <uint> [#uses=1] %tmp190 = and i32 %tmp186, -17 ; <i32> [#uses=1]
%tmp191 = or uint %tmp190, %tmp188 ; <uint> [#uses=1] %tmp191 = or i32 %tmp190, %tmp188 ; <i32> [#uses=1]
store uint %tmp191, uint* %tmp185 store i32 %tmp191, i32* %tmp185
%tmp193 = getelementptr %struct.attr_desc* null, int 0, uint 4 ; <uint*> [#uses=1] %tmp193 = getelementptr %struct.attr_desc* null, i32 0, i32 4 ; <i32*> [#uses=1]
%tmp194 = load uint* %tmp193 ; <uint> [#uses=1] %tmp194 = load i32* %tmp193 ; <i32> [#uses=1]
%tmp198 = getelementptr %struct.attr_desc* null, int 0, uint 4 ; <uint*> [#uses=2] %tmp198 = getelementptr %struct.attr_desc* null, i32 0, i32 4 ; <i32*> [#uses=2]
%tmp199 = load uint* %tmp198 ; <uint> [#uses=1] %tmp199 = load i32* %tmp198 ; <i32> [#uses=1]
%tmp196200 = shl uint %tmp194, ubyte 2 ; <uint> [#uses=1] %tmp196200 = shl i32 %tmp194, 2 ; <i32> [#uses=1]
%tmp201 = and uint %tmp196200, 64 ; <uint> [#uses=1] %tmp201 = and i32 %tmp196200, 64 ; <i32> [#uses=1]
%tmp203 = and uint %tmp199, 4294967231 ; <uint> [#uses=1] %tmp203 = and i32 %tmp199, -65 ; <i32> [#uses=1]
%tmp204 = or uint %tmp203, %tmp201 ; <uint> [#uses=1] %tmp204 = or i32 %tmp203, %tmp201 ; <i32> [#uses=1]
store uint %tmp204, uint* %tmp198 store i32 %tmp204, i32* %tmp198
%tmp206 = getelementptr %struct.attr_desc* null, int 0, uint 4 ; <uint*> [#uses=1] %tmp206 = getelementptr %struct.attr_desc* null, i32 0, i32 4 ; <i32*> [#uses=1]
%tmp207 = load uint* %tmp206 ; <uint> [#uses=1] %tmp207 = load i32* %tmp206 ; <i32> [#uses=1]
%tmp211 = getelementptr %struct.attr_desc* null, int 0, uint 4 ; <uint*> [#uses=2] %tmp211 = getelementptr %struct.attr_desc* null, i32 0, i32 4 ; <i32*> [#uses=2]
%tmp212 = load uint* %tmp211 ; <uint> [#uses=1] %tmp212 = load i32* %tmp211 ; <i32> [#uses=1]
%tmp209213 = shl uint %tmp207, ubyte 1 ; <uint> [#uses=1] %tmp209213 = shl i32 %tmp207, 1 ; <i32> [#uses=1]
%tmp214 = and uint %tmp209213, 128 ; <uint> [#uses=1] %tmp214 = and i32 %tmp209213, 128 ; <i32> [#uses=1]
%tmp216 = and uint %tmp212, 4294967167 ; <uint> [#uses=1] %tmp216 = and i32 %tmp212, -129 ; <i32> [#uses=1]
%tmp217 = or uint %tmp216, %tmp214 ; <uint> [#uses=1] %tmp217 = or i32 %tmp216, %tmp214 ; <i32> [#uses=1]
store uint %tmp217, uint* %tmp211 store i32 %tmp217, i32* %tmp211
ret void ret void
} }

View File

@ -1,16 +1,17 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -mtriple=powerpc64-apple-darwin | grep extsw | count 2 ; RUN: llvm-as < %s | llc -mtriple=powerpc64-apple-darwin | grep extsw | count 2
%lens = external global ubyte* @lens = external global i8* ; <i8**> [#uses=1]
%vals = external global int* @vals = external global i32* ; <i32**> [#uses=1]
int %test(int %i) { define i32 @test(i32 %i) {
%tmp = load ubyte** %lens %tmp = load i8** @lens ; <i8*> [#uses=1]
%tmp1 = getelementptr ubyte* %tmp, int %i %tmp1 = getelementptr i8* %tmp, i32 %i ; <i8*> [#uses=1]
%tmp = load ubyte* %tmp1 %tmp.upgrd.1 = load i8* %tmp1 ; <i8> [#uses=1]
%tmp2 = cast ubyte %tmp to int %tmp2 = zext i8 %tmp.upgrd.1 to i32 ; <i32> [#uses=1]
%tmp3 = load int** %vals %tmp3 = load i32** @vals ; <i32*> [#uses=1]
%tmp5 = sub int 1, %tmp2 %tmp5 = sub i32 1, %tmp2 ; <i32> [#uses=1]
%tmp6 = getelementptr int* %tmp3, int %tmp5 %tmp6 = getelementptr i32* %tmp3, i32 %tmp5 ; <i32*> [#uses=1]
%tmp7 = load int* %tmp6 %tmp7 = load i32* %tmp6 ; <i32> [#uses=1]
ret int %tmp7 ret i32 %tmp7
} }

View File

@ -1,10 +1,11 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 ; RUN: llvm-as < %s | llc -march=ppc32
void %img2buf(int %symbol_size_in_bytes, ushort* %ui16) { define void @img2buf(i32 %symbol_size_in_bytes, i16* %ui16) {
%tmp93 = load ushort* null ; <ushort> [#uses=1] %tmp93 = load i16* null ; <i16> [#uses=1]
%tmp99 = call ushort %llvm.bswap.i16( ushort %tmp93 ) ; <ushort> [#uses=1] %tmp99 = call i16 @llvm.bswap.i16( i16 %tmp93 ) ; <i16> [#uses=1]
store ushort %tmp99, ushort* %ui16 store i16 %tmp99, i16* %ui16
ret void ret void
} }
declare ushort %llvm.bswap.i16(ushort) declare i16 @llvm.bswap.i16(i16)

View File

@ -1,8 +1,8 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g5 | grep vsldoi ; RUN: llvm-as < %s | llc -march=ppc32 -mcpu=g5 | grep vsldoi
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g5 | not grep vor ; RUN: llvm-as < %s | llc -march=ppc32 -mcpu=g5 | not grep vor
<4 x float> %func(<4 x float> %fp0, <4 x float> %fp1) { define <4 x float> @func(<4 x float> %fp0, <4 x float> %fp1) {
%tmp76 = shufflevector <4 x float> %fp0, <4 x float> %fp1, <4 x uint> < uint 0, uint 1, uint 2, uint 7 > ; <<4 x float>> [#uses=1] %tmp76 = shufflevector <4 x float> %fp0, <4 x float> %fp1, <4 x i32> < i32 0, i32 1, i32 2, i32 7 > ; <<4 x float>> [#uses=1]
ret <4 x float> %tmp76 ret <4 x float> %tmp76
} }

View File

@ -1,38 +1,30 @@
; RUN: llvm-upgrade < %s | llvm-as | llc ; RUN: llvm-as < %s | llc
%struct..0anon = type { int } %struct..0anon = type { i32 }
%struct.rtx_def = type { ushort, ubyte, ubyte, [1 x %struct..0anon] } %struct.rtx_def = type { i16, i8, i8, [1 x %struct..0anon] }
implementation ; Functions: define fastcc void @immed_double_const(i32 %i0, i32 %i1) {
fastcc void %immed_double_const(int %i0, int %i1) {
entry: entry:
%tmp1 = load uint* null ; <uint> [#uses=1] %tmp1 = load i32* null ; <i32> [#uses=1]
switch uint %tmp1, label %bb103 [ switch i32 %tmp1, label %bb103 [
uint 1, label %bb i32 1, label %bb
uint 3, label %bb i32 3, label %bb
] ]
bb: ; preds = %entry, %entry bb: ; preds = %entry, %entry
%tmp14 = setgt int 0, 31 ; <bool> [#uses=1] %tmp14 = icmp sgt i32 0, 31 ; <i1> [#uses=1]
br bool %tmp14, label %cond_next77, label %cond_next17 br i1 %tmp14, label %cond_next77, label %cond_next17
cond_next17: ; preds = %bb cond_next17: ; preds = %bb
ret void ret void
cond_next77: ; preds = %bb cond_next77: ; preds = %bb
%tmp79.not = setne int %i1, 0 ; <bool> [#uses=1] %tmp79.not = icmp ne i32 %i1, 0 ; <i1> [#uses=1]
%tmp84 = setlt int %i0, 0 ; <bool> [#uses=2] %tmp84 = icmp slt i32 %i0, 0 ; <i1> [#uses=2]
%bothcond1 = or bool %tmp79.not, %tmp84 ; <bool> [#uses=1] %bothcond1 = or i1 %tmp79.not, %tmp84 ; <i1> [#uses=1]
br bool %bothcond1, label %bb88, label %bb99 br i1 %bothcond1, label %bb88, label %bb99
bb88: ; preds = %cond_next77 bb88: ; preds = %cond_next77
%bothcond2 = and bool false, %tmp84 ; <bool> [#uses=0] %bothcond2 = and i1 false, %tmp84 ; <i1> [#uses=0]
ret void ret void
bb99: ; preds = %cond_next77 bb99: ; preds = %cond_next77
ret void ret void
bb103: ; preds = %entry bb103: ; preds = %entry
ret void ret void
} }

View File

@ -1,27 +1,25 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 ; RUN: llvm-as < %s | llc -march=ppc64
target endian = big
target pointersize = 64 target datalayout = "E-p:64:64"
target triple = "powerpc64-apple-darwin8" target triple = "powerpc64-apple-darwin8"
implementation ; Functions: define void @glArrayElement_CompExec() {
void %glArrayElement_CompExec() {
entry: entry:
%tmp3 = and ulong 0, 18446744073701163007 ; <ulong> [#uses=1] %tmp3 = and i64 0, -8388609 ; <i64> [#uses=1]
br label %cond_true24 br label %cond_true24
cond_false: ; preds = %cond_true24
cond_false: ; preds = %cond_true24 ret void
ret void cond_true24: ; preds = %cond_true24, %entry
%indvar.ph = phi i32 [ 0, %entry ], [ %indvar.next, %cond_true24 ] ; <i32> [#uses=1]
cond_true24: ; preds = %cond_true24, %entry %indvar = add i32 0, %indvar.ph ; <i32> [#uses=2]
%indvar.ph = phi uint [ 0, %entry ], [ %indvar.next, %cond_true24 ] ; <uint> [#uses=1] %code.0 = trunc i32 %indvar to i8 ; <i8> [#uses=1]
%indvar = add uint 0, %indvar.ph ; <uint> [#uses=2] %tmp5 = add i8 %code.0, 16 ; <i8> [#uses=1]
%code.0 = cast uint %indvar to ubyte ; <ubyte> [#uses=1] %shift.upgrd.1 = zext i8 %tmp5 to i64 ; <i64> [#uses=1]
%tmp5 = add ubyte %code.0, 16 ; <ubyte> [#uses=1] %tmp7 = lshr i64 %tmp3, %shift.upgrd.1 ; <i64> [#uses=1]
%tmp7 = shr ulong %tmp3, ubyte %tmp5 ; <ulong> [#uses=1] %tmp7.upgrd.2 = trunc i64 %tmp7 to i32 ; <i32> [#uses=1]
%tmp7 = cast ulong %tmp7 to int ; <int> [#uses=1] %tmp8 = and i32 %tmp7.upgrd.2, 1 ; <i32> [#uses=1]
%tmp8 = and int %tmp7, 1 ; <int> [#uses=1] %tmp8.upgrd.3 = icmp eq i32 %tmp8, 0 ; <i1> [#uses=1]
%tmp8 = seteq int %tmp8, 0 ; <bool> [#uses=1] %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1]
%indvar.next = add uint %indvar, 1 ; <uint> [#uses=1] br i1 %tmp8.upgrd.3, label %cond_false, label %cond_true24
br bool %tmp8, label %cond_false, label %cond_true24
} }

View File

@ -1,26 +1,24 @@
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc32 -combiner-alias-analysis | grep f5 ; RUN: llc -march=ppc32 -combiner-alias-analysis | grep f5
target endian = big target datalayout = "E-p:32:32"
target pointersize = 32
target triple = "powerpc-apple-darwin8.2.0" target triple = "powerpc-apple-darwin8.2.0"
%struct.Point = type { double, double, double } %struct.Point = type { double, double, double }
implementation ; Functions: define void @offset(%struct.Point* %pt, double %x, double %y, double %z) {
void %offset(%struct.Point* %pt, double %x, double %y, double %z) {
entry: entry:
%tmp = getelementptr %struct.Point* %pt, int 0, uint 0 ; <double*> [#uses=2] %tmp = getelementptr %struct.Point* %pt, i32 0, i32 0 ; <double*> [#uses=2]
%tmp = load double* %tmp ; <double> [#uses=1] %tmp.upgrd.1 = load double* %tmp ; <double> [#uses=1]
%tmp2 = add double %tmp, %x ; <double> [#uses=1] %tmp2 = add double %tmp.upgrd.1, %x ; <double> [#uses=1]
store double %tmp2, double* %tmp store double %tmp2, double* %tmp
%tmp6 = getelementptr %struct.Point* %pt, int 0, uint 1 ; <double*> [#uses=2] %tmp6 = getelementptr %struct.Point* %pt, i32 0, i32 1 ; <double*> [#uses=2]
%tmp7 = load double* %tmp6 ; <double> [#uses=1] %tmp7 = load double* %tmp6 ; <double> [#uses=1]
%tmp9 = add double %tmp7, %y ; <double> [#uses=1] %tmp9 = add double %tmp7, %y ; <double> [#uses=1]
store double %tmp9, double* %tmp6 store double %tmp9, double* %tmp6
%tmp13 = getelementptr %struct.Point* %pt, int 0, uint 2 ; <double*> [#uses=2] %tmp13 = getelementptr %struct.Point* %pt, i32 0, i32 2 ; <double*> [#uses=2]
%tmp14 = load double* %tmp13 ; <double> [#uses=1] %tmp14 = load double* %tmp13 ; <double> [#uses=1]
%tmp16 = add double %tmp14, %z ; <double> [#uses=1] %tmp16 = add double %tmp14, %z ; <double> [#uses=1]
store double %tmp16, double* %tmp13 store double %tmp16, double* %tmp13
ret void ret void
} }

View File

@ -1,18 +1,16 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep IMPLICIT_DEF ; RUN: llvm-as < %s | llc -march=ppc32 | not grep IMPLICIT_DEF
void %foo(long %X) { define void @foo(i64 %X) {
entry: entry:
%tmp1 = and long %X, 3 ; <long> [#uses=1] %tmp1 = and i64 %X, 3 ; <i64> [#uses=1]
%tmp = setgt long %tmp1, 2 ; <bool> [#uses=1] %tmp = icmp sgt i64 %tmp1, 2 ; <i1> [#uses=1]
br bool %tmp, label %UnifiedReturnBlock, label %cond_true br i1 %tmp, label %UnifiedReturnBlock, label %cond_true
cond_true: ; preds = %entry cond_true: ; preds = %entry
%tmp = tail call int (...)* %bar( ) ; <int> [#uses=0] %tmp.upgrd.1 = tail call i32 (...)* @bar( ) ; <i32> [#uses=0]
ret void ret void
UnifiedReturnBlock: ; preds = %entry UnifiedReturnBlock: ; preds = %entry
ret void ret void
} }
declare int %bar(...) declare i32 @bar(...)

View File

@ -1,24 +1,20 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep xor ; RUN: llvm-as < %s | llc -march=ppc32 | grep xor
target endian = big target datalayout = "E-p:32:32"
target pointersize = 32
target triple = "powerpc-apple-darwin8.7.0" target triple = "powerpc-apple-darwin8.7.0"
implementation ; Functions: define void @foo(i32 %X) {
void %foo(int %X) {
entry: entry:
%tmp1 = and int %X, 3 ; <int> [#uses=1] %tmp1 = and i32 %X, 3 ; <i32> [#uses=1]
%tmp2 = xor int %tmp1, 1 %tmp2 = xor i32 %tmp1, 1 ; <i32> [#uses=1]
%tmp = seteq int %tmp2, 0 ; <bool> [#uses=1] %tmp = icmp eq i32 %tmp2, 0 ; <i1> [#uses=1]
br bool %tmp, label %UnifiedReturnBlock, label %cond_true br i1 %tmp, label %UnifiedReturnBlock, label %cond_true
cond_true: ; preds = %entry
cond_true: ; preds = %entry tail call i32 (...)* @bar( ) ; <i32>:0 [#uses=0]
tail call int (...)* %bar( ) ; <int> [#uses=0] ret void
ret void UnifiedReturnBlock: ; preds = %entry
ret void
UnifiedReturnBlock: ; preds = %entry
ret void
} }
declare int %bar(...) declare i32 @bar(...)

View File

@ -1,6 +1,7 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 ; RUN: llvm-as < %s | llc -march=ppc64
int * %foo(uint %n) { define i32* @foo(i32 %n) {
%A = alloca int, uint %n %A = alloca i32, i32 %n ; <i32*> [#uses=1]
ret int* %A ret i32* %A
} }

View File

@ -1,14 +1,13 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | grep rlwimi ; RUN: llvm-as < %s | llc -march=ppc32 | grep rlwimi
void %test(short %div.0.i.i.i.i, int %L_num.0.i.i.i.i, int %tmp1.i.i206.i.i, short* %P) { define void @test(i16 %div.0.i.i.i.i, i32 %L_num.0.i.i.i.i, i32 %tmp1.i.i206.i.i, i16* %P) {
%X = shl short %div.0.i.i.i.i, ubyte 1 ; <short> [#uses=1] %X = shl i16 %div.0.i.i.i.i, 1 ; <i16> [#uses=1]
%tmp28.i.i.i.i = shl int %L_num.0.i.i.i.i, ubyte 1 ; <int> [#uses=2] %tmp28.i.i.i.i = shl i32 %L_num.0.i.i.i.i, 1 ; <i32> [#uses=1]
%tmp31.i.i.i.i = setlt int %tmp28.i.i.i.i, %tmp1.i.i206.i.i ; <bool> [#uses=2] %tmp31.i.i.i.i = icmp slt i32 %tmp28.i.i.i.i, %tmp1.i.i206.i.i ; <i1> [#uses=1]
%tmp31.i.i.i.i.upgrd.1 = zext i1 %tmp31.i.i.i.i to i16 ; <i16> [#uses=1]
%tmp31.i.i.i.i = cast bool %tmp31.i.i.i.i to short ; <short> [#uses=1] %tmp371.i.i.i.i1 = or i16 %tmp31.i.i.i.i.upgrd.1, %X ; <i16> [#uses=1]
%tmp371.i.i.i.i1 = or short %tmp31.i.i.i.i, %X ; <short> [#uses=1] %div.0.be.i.i.i.i = xor i16 %tmp371.i.i.i.i1, 1 ; <i16> [#uses=1]
%div.0.be.i.i.i.i = xor short %tmp371.i.i.i.i1, 1 ; <short> [#uses=1] store i16 %div.0.be.i.i.i.i, i16* %P
store short %div.0.be.i.i.i.i, short* %P
ret void ret void
} }

View File

@ -1,10 +1,10 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -mcpu=g5 ; RUN: llvm-as < %s | llc -march=ppc32 -mcpu=g5
void %glgRunProcessor15() { define void @glgRunProcessor15() {
%tmp26355.i = shufflevector <4 x float> zeroinitializer, <4 x float> < float 0x379FFFE000000000, float 0x379FFFE000000000, float 0x379FFFE000000000, float 0x379FFFE000000000 >, <4 x uint> < uint 0, uint 1, uint 2, uint 7 > ; <<4 x float>> [#uses=1] %tmp26355.i = shufflevector <4 x float> zeroinitializer, <4 x float> < float 0x379FFFE000000000, float 0x379FFFE000000000, float 0x379FFFE000000000, float 0x379FFFE000000000 >, <4 x i32> < i32 0, i32 1, i32 2, i32 7 >; <<4 x float>> [#uses=1]
%tmp3030030304.i = cast <4 x float> %tmp26355.i to <8 x short> ; <<8 x short>> [#uses=1] %tmp3030030304.i = bitcast <4 x float> %tmp26355.i to <8 x i16> ; <<8 x i16>> [#uses=1]
%tmp30305.i = shufflevector <8 x short> zeroinitializer, <8 x short> %tmp3030030304.i, <8 x uint> < uint 1, uint 3, uint 5, uint 7, uint 9, uint 11, uint 13, uint 15 > ; <<8 x short>> [#uses=1] %tmp30305.i = shufflevector <8 x i16> zeroinitializer, <8 x i16> %tmp3030030304.i, <8 x i32> < i32 1, i32 3, i32 5, i32 7, i32 9, i32 11, i32 13, i32 15 > ; <<8 x i16>> [#uses=1]
%tmp30305.i = cast <8 x short> %tmp30305.i to <4 x int> ; <<4 x int>> [#uses=1] %tmp30305.i.upgrd.1 = bitcast <8 x i16> %tmp30305.i to <4 x i32> ; <<4 x i32>> [#uses=1]
store <4 x int> %tmp30305.i, <4 x int>* null store <4 x i32> %tmp30305.i.upgrd.1, <4 x i32>* null
ret void ret void
} }

View File

@ -1,26 +1,24 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 ; RUN: llvm-as < %s | llc -march=ppc64
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 ; RUN: llvm-as < %s | llc -march=ppc32
; RUN: llvm-upgrade < %s | llvm-as | llc ; RUN: llvm-as < %s | llc
void %bitap() { define void @bitap() {
entry: entry:
%RMask.i = alloca [256 x uint], align 16 ; <[256 x uint]*> [#uses=1] %RMask.i = alloca [256 x i32], align 16 ; <[256 x i32]*> [#uses=1]
%buffer = alloca [147456 x sbyte], align 16 ; <[147456 x sbyte]*> [#uses=0] %buffer = alloca [147456 x i8], align 16 ; <[147456 x i8]*> [#uses=0]
br bool false, label %bb19, label %bb.preheader br i1 false, label %bb19, label %bb.preheader
bb.preheader: ; preds = %entry
bb.preheader: ; preds = %entry ret void
ret void bb19: ; preds = %entry
br i1 false, label %bb12.i, label %cond_next39
bb19: ; preds = %entry bb12.i: ; preds = %bb12.i, %bb19
br bool false, label %bb12.i, label %cond_next39 %i.0.i = phi i32 [ %tmp11.i, %bb12.i ], [ 0, %bb19 ] ; <i32> [#uses=2]
%gep.upgrd.1 = zext i32 %i.0.i to i64 ; <i64> [#uses=1]
bb12.i: ; preds = %bb12.i, %bb19 %tmp9.i = getelementptr [256 x i32]* %RMask.i, i32 0, i64 %gep.upgrd.1 ; <i32*> [#uses=1]
%i.0.i = phi uint [ %tmp11.i, %bb12.i ], [ 0, %bb19 ] ; <uint> [#uses=2] store i32 0, i32* %tmp9.i
%tmp9.i = getelementptr [256 x uint]* %RMask.i, int 0, uint %i.0.i ; <uint*> [#uses=1] %tmp11.i = add i32 %i.0.i, 1 ; <i32> [#uses=1]
store uint 0, uint* %tmp9.i br label %bb12.i
%tmp11.i = add uint %i.0.i, 1 ; <uint> [#uses=1] cond_next39: ; preds = %bb19
br label %bb12.i ret void
cond_next39: ; preds = %bb19
ret void
} }

View File

@ -1,27 +1,22 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 ; RUN: llvm-as < %s | llc -march=ppc64
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 ; RUN: llvm-as < %s | llc -march=ppc32
; RUN: llvm-upgrade < %s | llvm-as | llc ; RUN: llvm-as < %s | llc
%qsz.b = external global bool ; <bool*> [#uses=1] @qsz.b = external global i1 ; <i1*> [#uses=1]
implementation ; Functions: define fastcc void @qst() {
fastcc void %qst() {
entry: entry:
br bool true, label %cond_next71, label %cond_true br i1 true, label %cond_next71, label %cond_true
cond_true: ; preds = %entry
cond_true: ; preds = %entry ret void
ret void cond_next71: ; preds = %entry
%tmp73.b = load i1* @qsz.b ; <i1> [#uses=1]
cond_next71: ; preds = %entry %ii.4.ph = select i1 %tmp73.b, i64 4, i64 0 ; <i64> [#uses=1]
%tmp73.b = load bool* %qsz.b ; <bool> [#uses=1] br label %bb139
%ii.4.ph = select bool %tmp73.b, ulong 4, ulong 0 ; <ulong> [#uses=1] bb82: ; preds = %bb139
br label %bb139 ret void
bb139: ; preds = %bb139, %cond_next71
bb82: ; preds = %bb139 %exitcond89 = icmp eq i64 0, %ii.4.ph ; <i1> [#uses=1]
ret void br i1 %exitcond89, label %bb82, label %bb139
bb139: ; preds = %bb139, %cond_next71
%exitcond89 = seteq ulong 0, %ii.4.ph ; <bool> [#uses=1]
br bool %exitcond89, label %bb82, label %bb139
} }

View File

@ -1,79 +1,77 @@
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | \ ; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | \
; RUN: not grep {stw r31, 20(r1)} ; RUN: not grep {stw r31, 20(r1)}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep {lis r0, -1} ; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | grep {lis r0, -1}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | \ ; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | \
; RUN: grep {ori r0, r0, 32704} ; RUN: grep {ori r0, r0, 32704}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | \ ; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | \
; RUN: grep {stwux r1, r1, r0} ; RUN: grep {stwux r1, r1, r0}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | \ ; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | \
; RUN: grep {lwz r1, 0(r1)} ; RUN: grep {lwz r1, 0(r1)}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | \ ; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 | \
; RUN: not grep {lwz r31, 20(r1)} ; RUN: not grep {lwz r31, 20(r1)}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ ; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \
; RUN: grep {stw r31, 20(r1)} ; RUN: grep {stw r31, 20(r1)}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ ; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \
; RUN: grep {lis r0, -1} ; RUN: grep {lis r0, -1}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ ; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \
; RUN: grep {ori r0, r0, 32704} ; RUN: grep {ori r0, r0, 32704}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ ; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \
; RUN: grep {stwux r1, r1, r0} ; RUN: grep {stwux r1, r1, r0}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ ; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \
; RUN: grep {lwz r1, 0(r1)} ; RUN: grep {lwz r1, 0(r1)}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ ; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \
; RUN: grep {lwz r31, 20(r1)} ; RUN: grep {lwz r31, 20(r1)}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \ ; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \
; RUN: not grep {std r31, 40(r1)} ; RUN: not grep {std r31, 40(r1)}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \ ; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \
; RUN: grep {lis r0, -1} ; RUN: grep {lis r0, -1}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \ ; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \
; RUN: grep {ori r0, r0, 32656} ; RUN: grep {ori r0, r0, 32656}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \ ; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \
; RUN: grep {stdux r1, r1, r0} ; RUN: grep {stdux r1, r1, r0}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \ ; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \
; RUN: grep {ld r1, 0(r1)} ; RUN: grep {ld r1, 0(r1)}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \ ; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 | \
; RUN: not grep {ld r31, 40(r1)} ; RUN: not grep {ld r31, 40(r1)}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ ; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \
; RUN: grep {std r31, 40(r1)} ; RUN: grep {std r31, 40(r1)}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ ; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \
; RUN: grep {lis r0, -1} ; RUN: grep {lis r0, -1}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ ; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \
; RUN: grep {ori r0, r0, 32656} ; RUN: grep {ori r0, r0, 32656}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ ; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \
; RUN: grep {stdux r1, r1, r0} ; RUN: grep {stdux r1, r1, r0}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ ; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \
; RUN: grep {ld r1, 0(r1)} ; RUN: grep {ld r1, 0(r1)}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \ ; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim | \
; RUN: grep {ld r31, 40(r1)} ; RUN: grep {ld r31, 40(r1)}
define i32* @f1() {
implementation %tmp = alloca i32, i32 8191 ; <i32*> [#uses=1]
ret i32* %tmp
int* %f1() {
%tmp = alloca int, uint 8191
ret int* %tmp
} }

View File

@ -1,40 +1,37 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \ ; RUN: llvm-as < %s | llc -march=ppc32 | \
; RUN: not grep {stw r31, 20(r1)} ; RUN: not grep {stw r31, 20(r1)}
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \ ; RUN: llvm-as < %s | llc -march=ppc32 | \
; RUN: not grep {stwu r1, -.*(r1)} ; RUN: not grep {stwu r1, -.*(r1)}
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \ ; RUN: llvm-as < %s | llc -march=ppc32 | \
; RUN: not grep {addi r1, r1, } ; RUN: not grep {addi r1, r1, }
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \ ; RUN: llvm-as < %s | llc -march=ppc32 | \
; RUN: not grep {lwz r31, 20(r1)} ; RUN: not grep {lwz r31, 20(r1)}
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -disable-fp-elim | \ ; RUN: llvm-as < %s | llc -march=ppc32 -disable-fp-elim | \
; RUN: not grep {stw r31, 20(r1)} ; RUN: not grep {stw r31, 20(r1)}
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -disable-fp-elim | \ ; RUN: llvm-as < %s | llc -march=ppc32 -disable-fp-elim | \
; RUN: not grep {stwu r1, -.*(r1)} ; RUN: not grep {stwu r1, -.*(r1)}
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -disable-fp-elim | \ ; RUN: llvm-as < %s | llc -march=ppc32 -disable-fp-elim | \
; RUN: not grep {addi r1, r1, } ; RUN: not grep {addi r1, r1, }
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -disable-fp-elim | \ ; RUN: llvm-as < %s | llc -march=ppc32 -disable-fp-elim | \
; RUN: not grep {lwz r31, 20(r1)} ; RUN: not grep {lwz r31, 20(r1)}
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | \ ; RUN: llvm-as < %s | llc -march=ppc64 | \
; RUN: not grep {std r31, 40(r1)} ; RUN: not grep {std r31, 40(r1)}
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | \ ; RUN: llvm-as < %s | llc -march=ppc64 | \
; RUN: not grep {stdu r1, -.*(r1)} ; RUN: not grep {stdu r1, -.*(r1)}
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | \ ; RUN: llvm-as < %s | llc -march=ppc64 | \
; RUN: not grep {addi r1, r1, } ; RUN: not grep {addi r1, r1, }
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | \ ; RUN: llvm-as < %s | llc -march=ppc64 | \
; RUN: not grep {ld r31, 40(r1)} ; RUN: not grep {ld r31, 40(r1)}
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -disable-fp-elim | \ ; RUN: llvm-as < %s | llc -march=ppc64 -disable-fp-elim | \
; RUN: not grep {stw r31, 40(r1)} ; RUN: not grep {stw r31, 40(r1)}
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -disable-fp-elim | \ ; RUN: llvm-as < %s | llc -march=ppc64 -disable-fp-elim | \
; RUN: not grep {stdu r1, -.*(r1)} ; RUN: not grep {stdu r1, -.*(r1)}
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -disable-fp-elim | \ ; RUN: llvm-as < %s | llc -march=ppc64 -disable-fp-elim | \
; RUN: not grep {addi r1, r1, } ; RUN: not grep {addi r1, r1, }
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 -disable-fp-elim | \ ; RUN: llvm-as < %s | llc -march=ppc64 -disable-fp-elim | \
; RUN: not grep {ld r31, 40(r1)} ; RUN: not grep {ld r31, 40(r1)}
define i32* @f1() {
implementation %tmp = alloca i32, i32 2 ; <i32*> [#uses=1]
ret i32* %tmp
int* %f1() {
%tmp = alloca int, uint 2
ret int* %tmp
} }

View File

@ -1,24 +1,24 @@
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -o %t1 -f ; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -o %t1 -f
; RUN not grep {stw r31, 20(r1)} %t1 ; RUN not grep {stw r31, 20(r1)} %t1
; RUN: grep {stwu r1, -16448(r1)} %t1 ; RUN: grep {stwu r1, -16448(r1)} %t1
; RUN: grep {addi r1, r1, 16448} %t1 ; RUN: grep {addi r1, r1, 16448} %t1
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: not grep {lwz r31, 20(r1)} ; RUN: not grep {lwz r31, 20(r1)}
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim \ ; RUN: llc -march=ppc32 -mtriple=powerpc-apple-darwin8 -disable-fp-elim \
; RUN: -o %t2 -f ; RUN: -o %t2 -f
; RUN: grep {stw r31, 20(r1)} %t2 ; RUN: grep {stw r31, 20(r1)} %t2
; RUN: grep {stwu r1, -16448(r1)} %t2 ; RUN: grep {stwu r1, -16448(r1)} %t2
; RUN: grep {addi r1, r1, 16448} %t2 ; RUN: grep {addi r1, r1, 16448} %t2
; RUN: grep {lwz r31, 20(r1)} %t2 ; RUN: grep {lwz r31, 20(r1)} %t2
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -o %t3 -f ; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -o %t3 -f
; RUN: not grep {std r31, 40(r1)} %t3 ; RUN: not grep {std r31, 40(r1)} %t3
; RUN: grep {stdu r1, -16496(r1)} %t3 ; RUN: grep {stdu r1, -16496(r1)} %t3
; RUN: grep {addi r1, r1, 16496} %t3 ; RUN: grep {addi r1, r1, 16496} %t3
; RUN: not grep {ld r31, 40(r1)} %t3 ; RUN: not grep {ld r31, 40(r1)} %t3
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim \ ; RUN: llc -march=ppc64 -mtriple=powerpc-apple-darwin8 -disable-fp-elim \
; RUN: -o %t4 -f ; RUN: -o %t4 -f
; RUN: grep {std r31, 40(r1)} %t4 ; RUN: grep {std r31, 40(r1)} %t4
@ -26,9 +26,8 @@
; RUN: grep {addi r1, r1, 16496} %t4 ; RUN: grep {addi r1, r1, 16496} %t4
; RUN: grep {ld r31, 40(r1)} %t4 ; RUN: grep {ld r31, 40(r1)} %t4
implementation define i32* @f1() {
%tmp = alloca i32, i32 4095 ; <i32*> [#uses=1]
int* %f1() { ret i32* %tmp
%tmp = alloca int, uint 4095
ret int* %tmp
} }

View File

@ -1,27 +1,26 @@
; All of these should be codegen'd without loading immediates ; All of these should be codegen'd without loading immediates
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -o %t -f ; RUN: llvm-as < %s | llc -march=ppc32 -o %t -f
; RUN: grep addc %t | count 1 ; RUN: grep addc %t | count 1
; RUN: grep adde %t | count 1 ; RUN: grep adde %t | count 1
; RUN: grep addze %t | count 1 ; RUN: grep addze %t | count 1
; RUN: grep addme %t | count 1 ; RUN: grep addme %t | count 1
; RUN: grep addic %t | count 2 ; RUN: grep addic %t | count 2
implementation ; Functions: define i64 @add_ll(i64 %a, i64 %b) {
long %add_ll(long %a, long %b) {
entry: entry:
%tmp.2 = add long %b, %a ; <long> [#uses=1] %tmp.2 = add i64 %b, %a ; <i64> [#uses=1]
ret long %tmp.2 ret i64 %tmp.2
} }
long %add_l_5(long %a) { define i64 @add_l_5(i64 %a) {
entry: entry:
%tmp.1 = add long %a, 5 ; <long> [#uses=1] %tmp.1 = add i64 %a, 5 ; <i64> [#uses=1]
ret long %tmp.1 ret i64 %tmp.1
} }
long %add_l_m5(long %a) { define i64 @add_l_m5(i64 %a) {
entry: entry:
%tmp.1 = add long %a, -5 ; <long> [#uses=1] %tmp.1 = add i64 %a, -5 ; <i64> [#uses=1]
ret long %tmp.1 ret i64 %tmp.1
} }

View File

@ -1,20 +1,19 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep addi ; RUN: llvm-as < %s | llc -march=ppc32 | not grep addi
%struct.X = type { [5 x sbyte] } %struct.X = type { [5 x i8] }
implementation ; Functions:
int %test1([4 x int]* %P, int %i) { define i32 @test1([4 x i32]* %P, i32 %i) {
%tmp.2 = add int %i, 2 ; <int> [#uses=1] %tmp.2 = add i32 %i, 2 ; <i32> [#uses=1]
%tmp.4 = getelementptr [4 x int]* %P, int %tmp.2, int 1 %tmp.4 = getelementptr [4 x i32]* %P, i32 %tmp.2, i32 1 ; <i32*> [#uses=1]
%tmp.5 = load int* %tmp.4 %tmp.5 = load i32* %tmp.4 ; <i32> [#uses=1]
ret int %tmp.5 ret i32 %tmp.5
} }
int %test2(%struct.X* %P, int %i) { define i32 @test2(%struct.X* %P, i32 %i) {
%tmp.2 = add int %i, 2 %tmp.2 = add i32 %i, 2 ; <i32> [#uses=1]
%tmp.5 = getelementptr %struct.X* %P, int %tmp.2, uint 0, int 1 %tmp.5 = getelementptr %struct.X* %P, i32 %tmp.2, i32 0, i32 1 ; <i8*> [#uses=1]
%tmp.6 = load sbyte* %tmp.5 %tmp.6 = load i8* %tmp.5 ; <i8> [#uses=1]
%tmp.7 = cast sbyte %tmp.6 to int %tmp.7 = sext i8 %tmp.6 to i32 ; <i32> [#uses=1]
ret int %tmp.7 ret i32 %tmp.7
} }

View File

@ -1,12 +1,11 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \ ; RUN: llvm-as < %s | llc -march=ppc32 | \
; RUN: grep align.4 | count 1 ; RUN: grep align.4 | count 1
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \ ; RUN: llvm-as < %s | llc -march=ppc32 | \
; RUN: grep align.2 | count 1 ; RUN: grep align.2 | count 1
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \ ; RUN: llvm-as < %s | llc -march=ppc32 | \
; RUN: grep align.3 | count 1 ; RUN: grep align.3 | count 1
@A = global <4 x i32> < i32 10, i32 20, i32 30, i32 40 > ; <<4 x i32>*> [#uses=0]
%A = global <4 x uint> < uint 10, uint 20, uint 30, uint 40 > @B = global float 1.000000e+02 ; <float*> [#uses=0]
%B = global float 1.000000e+02 @C = global double 2.000000e+03 ; <double*> [#uses=0]
%C = global double 2.000000e+03

View File

@ -1,18 +1,17 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep mfcr ; RUN: llvm-as < %s | llc -march=ppc32 | not grep mfcr
void %foo(int %X, int %Y, int %Z) { define void @foo(i32 %X, i32 %Y, i32 %Z) {
entry: entry:
%tmp = seteq int %X, 0 ; <bool> [#uses=1] %tmp = icmp eq i32 %X, 0 ; <i1> [#uses=1]
%tmp3 = setlt int %Y, 5 ; <bool> [#uses=1] %tmp3 = icmp slt i32 %Y, 5 ; <i1> [#uses=1]
%tmp4 = and bool %tmp3, %tmp ; <bool> [#uses=1] %tmp4 = and i1 %tmp3, %tmp ; <i1> [#uses=1]
br bool %tmp4, label %cond_true, label %UnifiedReturnBlock br i1 %tmp4, label %cond_true, label %UnifiedReturnBlock
cond_true: ; preds = %entry
cond_true: ; preds = %entry %tmp5 = tail call i32 (...)* @bar( ) ; <i32> [#uses=0]
%tmp5 = tail call int (...)* %bar( ) ; <int> [#uses=0] ret void
ret void UnifiedReturnBlock: ; preds = %entry
ret void
UnifiedReturnBlock: ; preds = %entry
ret void
} }
declare int %bar(...) declare i32 @bar(...)

View File

@ -1,12 +1,14 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep {ori\\|lis} ; RUN: llvm-as < %s | llc -march=ppc32 | not grep {ori\\|lis}
int %test(int %X) { ; andi. r3, r3, 32769
%Y = and int %X, 32769 ; andi. r3, r3, 32769 define i32 @test(i32 %X) {
ret int %Y %Y = and i32 %X, 32769 ; <i32> [#uses=1]
ret i32 %Y
} }
int %test2(int %X) { ; andis. r3, r3, 32769
%Y = and int %X, -2147418112 ; andis. r3, r3, 32769 define i32 @test2(i32 %X) {
ret int %Y %Y = and i32 %X, -2147418112 ; <i32> [#uses=1]
ret i32 %Y
} }

View File

@ -1,12 +1,15 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 -o %t -f ; RUN: llvm-as < %s | llc -march=ppc32 -o %t -f
; RUN: grep slwi %t ; RUN: grep slwi %t
; RUN: not grep addi %t ; RUN: not grep addi %t
; RUN: not grep rlwinm %t ; RUN: not grep rlwinm %t
int %test(int %A) { define i32 @test(i32 %A) {
%B = mul int %A, 8 ;; shift ;; shift
%C = add int %B, 7 ;; dead, no demanded bits. %B = mul i32 %A, 8 ; <i32> [#uses=1]
%D = and int %C, -8 ;; dead once add is gone. ;; dead, no demanded bits.
ret int %D %C = add i32 %B, 7 ; <i32> [#uses=1]
;; dead once add is gone.
%D = and i32 %C, -8 ; <i32> [#uses=1]
ret i32 %D
} }

View File

@ -1,26 +1,27 @@
; Neither of these functions should contain algebraic right shifts ; Neither of these functions should contain algebraic right shifts
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep srawi ; RUN: llvm-as < %s | llc -march=ppc32 | not grep srawi
int %test1(uint %mode.0.i.0) { define i32 @test1(i32 %mode.0.i.0) {
%tmp.79 = cast uint %mode.0.i.0 to int ; <sbyte> [#uses=1] %tmp.79 = bitcast i32 %mode.0.i.0 to i32 ; <i32> [#uses=1]
%tmp.80 = shr int %tmp.79, ubyte 15 ; <int> [#uses=1] %tmp.80 = ashr i32 %tmp.79, 15 ; <i32> [#uses=1]
%tmp.81 = and int %tmp.80, 24 ; <int> [#uses=1] %tmp.81 = and i32 %tmp.80, 24 ; <i32> [#uses=1]
ret int %tmp.81 ret i32 %tmp.81
} }
int %test2(uint %mode.0.i.0) { define i32 @test2(i32 %mode.0.i.0) {
%tmp.79 = cast uint %mode.0.i.0 to int ; <sbyte> [#uses=1] %tmp.79 = bitcast i32 %mode.0.i.0 to i32 ; <i32> [#uses=1]
%tmp.80 = shr int %tmp.79, ubyte 15 ; <int> [#uses=1] %tmp.80 = ashr i32 %tmp.79, 15 ; <i32> [#uses=1]
%tmp.81 = shr uint %mode.0.i.0, ubyte 16 %tmp.81 = lshr i32 %mode.0.i.0, 16 ; <i32> [#uses=1]
%tmp.82 = cast uint %tmp.81 to int %tmp.82 = bitcast i32 %tmp.81 to i32 ; <i32> [#uses=1]
%tmp.83 = and int %tmp.80, %tmp.82 ; <int> [#uses=1] %tmp.83 = and i32 %tmp.80, %tmp.82 ; <i32> [#uses=1]
ret int %tmp.83 ret i32 %tmp.83
} }
uint %test3(int %specbits.6.1) { define i32 @test3(i32 %specbits.6.1) {
%tmp.2540 = shr int %specbits.6.1, ubyte 11 ; <int> [#uses=1] %tmp.2540 = ashr i32 %specbits.6.1, 11 ; <i32> [#uses=1]
%tmp.2541 = cast int %tmp.2540 to uint ; <uint> [#uses=1] %tmp.2541 = bitcast i32 %tmp.2540 to i32 ; <i32> [#uses=1]
%tmp.2542 = shl uint %tmp.2541, ubyte 13 ; <uint> [#uses=1] %tmp.2542 = shl i32 %tmp.2541, 13 ; <i32> [#uses=1]
%tmp.2543 = and uint %tmp.2542, 8192 ; <uint> [#uses=1] %tmp.2543 = and i32 %tmp.2542, 8192 ; <i32> [#uses=1]
ret uint %tmp.2543 ret i32 %tmp.2543
} }

View File

@ -1,93 +1,71 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \ ; RUN: llvm-as < %s | llc -march=ppc32 | \
; RUN: grep {b LBB.*} | count 4 ; RUN: grep {b LBB.*} | count 4
target endian = big target datalayout = "E-p:32:32"
target pointersize = 32
target triple = "powerpc-apple-darwin8.7.0" target triple = "powerpc-apple-darwin8.7.0"
implementation ; Functions: define void @foo(i32 %W, i32 %X, i32 %Y, i32 %Z) {
void %foo(int %W, int %X, int %Y, int %Z) {
entry: entry:
%X = cast int %X to uint ; <uint> [#uses=1] %tmp1 = and i32 %W, 1 ; <i32> [#uses=1]
%Y = cast int %Y to uint ; <uint> [#uses=1] %tmp1.upgrd.1 = icmp eq i32 %tmp1, 0 ; <i1> [#uses=1]
%Z = cast int %Z to uint ; <uint> [#uses=1] br i1 %tmp1.upgrd.1, label %cond_false, label %bb5
%W = cast int %W to uint ; <uint> [#uses=1]
%tmp1 = and int %W, 1 ; <int> [#uses=1]
%tmp1 = seteq int %tmp1, 0 ; <bool> [#uses=1]
br bool %tmp1, label %cond_false, label %bb5
bb: ; preds = %bb5, %bb bb: ; preds = %bb5, %bb
%indvar77 = phi uint [ %indvar.next78, %bb ], [ 0, %bb5 ] ; <uint> [#uses=1] %indvar77 = phi i32 [ %indvar.next78, %bb ], [ 0, %bb5 ] ; <i32> [#uses=1]
%tmp2 = tail call int (...)* %bar( ) ; <int> [#uses=0] %tmp2 = tail call i32 (...)* @bar( ) ; <i32> [#uses=0]
%indvar.next78 = add uint %indvar77, 1 ; <uint> [#uses=2] %indvar.next78 = add i32 %indvar77, 1 ; <i32> [#uses=2]
%exitcond79 = seteq uint %indvar.next78, %X ; <bool> [#uses=1] %exitcond79 = icmp eq i32 %indvar.next78, %X ; <i1> [#uses=1]
br bool %exitcond79, label %cond_next48, label %bb br i1 %exitcond79, label %cond_next48, label %bb
bb5: ; preds = %entry bb5: ; preds = %entry
%tmp = seteq int %X, 0 ; <bool> [#uses=1] %tmp = icmp eq i32 %X, 0 ; <i1> [#uses=1]
br bool %tmp, label %cond_next48, label %bb br i1 %tmp, label %cond_next48, label %bb
cond_false: ; preds = %entry cond_false: ; preds = %entry
%tmp10 = and int %W, 2 ; <int> [#uses=1] %tmp10 = and i32 %W, 2 ; <i32> [#uses=1]
%tmp10 = seteq int %tmp10, 0 ; <bool> [#uses=1] %tmp10.upgrd.2 = icmp eq i32 %tmp10, 0 ; <i1> [#uses=1]
br bool %tmp10, label %cond_false20, label %bb16 br i1 %tmp10.upgrd.2, label %cond_false20, label %bb16
bb12: ; preds = %bb16, %bb12 bb12: ; preds = %bb16, %bb12
%indvar72 = phi uint [ %indvar.next73, %bb12 ], [ 0, %bb16 ] ; <uint> [#uses=1] %indvar72 = phi i32 [ %indvar.next73, %bb12 ], [ 0, %bb16 ] ; <i32> [#uses=1]
%tmp13 = tail call int (...)* %bar( ) ; <int> [#uses=0] %tmp13 = tail call i32 (...)* @bar( ) ; <i32> [#uses=0]
%indvar.next73 = add uint %indvar72, 1 ; <uint> [#uses=2] %indvar.next73 = add i32 %indvar72, 1 ; <i32> [#uses=2]
%exitcond74 = seteq uint %indvar.next73, %Y ; <bool> [#uses=1] %exitcond74 = icmp eq i32 %indvar.next73, %Y ; <i1> [#uses=1]
br bool %exitcond74, label %cond_next48, label %bb12 br i1 %exitcond74, label %cond_next48, label %bb12
bb16: ; preds = %cond_false bb16: ; preds = %cond_false
%tmp18 = seteq int %Y, 0 ; <bool> [#uses=1] %tmp18 = icmp eq i32 %Y, 0 ; <i1> [#uses=1]
br bool %tmp18, label %cond_next48, label %bb12 br i1 %tmp18, label %cond_next48, label %bb12
cond_false20: ; preds = %cond_false cond_false20: ; preds = %cond_false
%tmp23 = and int %W, 4 ; <int> [#uses=1] %tmp23 = and i32 %W, 4 ; <i32> [#uses=1]
%tmp23 = seteq int %tmp23, 0 ; <bool> [#uses=1] %tmp23.upgrd.3 = icmp eq i32 %tmp23, 0 ; <i1> [#uses=1]
br bool %tmp23, label %cond_false33, label %bb29 br i1 %tmp23.upgrd.3, label %cond_false33, label %bb29
bb25: ; preds = %bb29, %bb25 bb25: ; preds = %bb29, %bb25
%indvar67 = phi uint [ %indvar.next68, %bb25 ], [ 0, %bb29 ] ; <uint> [#uses=1] %indvar67 = phi i32 [ %indvar.next68, %bb25 ], [ 0, %bb29 ] ; <i32> [#uses=1]
%tmp26 = tail call int (...)* %bar( ) ; <int> [#uses=0] %tmp26 = tail call i32 (...)* @bar( ) ; <i32> [#uses=0]
%indvar.next68 = add uint %indvar67, 1 ; <uint> [#uses=2] %indvar.next68 = add i32 %indvar67, 1 ; <i32> [#uses=2]
%exitcond69 = seteq uint %indvar.next68, %Z ; <bool> [#uses=1] %exitcond69 = icmp eq i32 %indvar.next68, %Z ; <i1> [#uses=1]
br bool %exitcond69, label %cond_next48, label %bb25 br i1 %exitcond69, label %cond_next48, label %bb25
bb29: ; preds = %cond_false20 bb29: ; preds = %cond_false20
%tmp31 = seteq int %Z, 0 ; <bool> [#uses=1] %tmp31 = icmp eq i32 %Z, 0 ; <i1> [#uses=1]
br bool %tmp31, label %cond_next48, label %bb25 br i1 %tmp31, label %cond_next48, label %bb25
cond_false33: ; preds = %cond_false20 cond_false33: ; preds = %cond_false20
%tmp36 = and int %W, 8 ; <int> [#uses=1] %tmp36 = and i32 %W, 8 ; <i32> [#uses=1]
%tmp36 = seteq int %tmp36, 0 ; <bool> [#uses=1] %tmp36.upgrd.4 = icmp eq i32 %tmp36, 0 ; <i1> [#uses=1]
br bool %tmp36, label %cond_next48, label %bb42 br i1 %tmp36.upgrd.4, label %cond_next48, label %bb42
bb38: ; preds = %bb42 bb38: ; preds = %bb42
%tmp39 = tail call int (...)* %bar( ) ; <int> [#uses=0] %tmp39 = tail call i32 (...)* @bar( ) ; <i32> [#uses=0]
%indvar.next = add uint %indvar, 1 ; <uint> [#uses=1] %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1]
br label %bb42 br label %bb42
bb42: ; preds = %bb38, %cond_false33
bb42: ; preds = %cond_false33, %bb38 %indvar = phi i32 [ %indvar.next, %bb38 ], [ 0, %cond_false33 ] ; <i32> [#uses=4]
%indvar = phi uint [ %indvar.next, %bb38 ], [ 0, %cond_false33 ] ; <uint> [#uses=3] %W_addr.0 = sub i32 %W, %indvar ; <i32> [#uses=1]
%indvar = cast uint %indvar to int ; <int> [#uses=1] %exitcond = icmp eq i32 %indvar, %W ; <i1> [#uses=1]
%W_addr.0 = sub int %W, %indvar ; <int> [#uses=1] br i1 %exitcond, label %cond_next48, label %bb38
%exitcond = seteq uint %indvar, %W ; <bool> [#uses=1] cond_next48: ; preds = %bb42, %cond_false33, %bb29, %bb25, %bb16, %bb12, %bb5, %bb
br bool %exitcond, label %cond_next48, label %bb38 %W_addr.1 = phi i32 [ %W, %bb5 ], [ %W, %bb16 ], [ %W, %bb29 ], [ %W, %cond_false33 ], [ %W_addr.0, %bb42 ], [ %W, %bb25 ], [ %W, %bb12 ], [ %W, %bb ] ; <i32> [#uses=1]
%tmp50 = icmp eq i32 %W_addr.1, 0 ; <i1> [#uses=1]
cond_next48: ; preds = %bb, %bb12, %bb25, %bb42, %cond_false33, %bb29, %bb16, %bb5 br i1 %tmp50, label %UnifiedReturnBlock, label %cond_true51
%W_addr.1 = phi int [ %W, %bb5 ], [ %W, %bb16 ], [ %W, %bb29 ], [ %W, %cond_false33 ], [ %W_addr.0, %bb42 ], [ %W, %bb25 ], [ %W, %bb12 ], [ %W, %bb ] ; <int> [#uses=1]
%tmp50 = seteq int %W_addr.1, 0 ; <bool> [#uses=1]
br bool %tmp50, label %UnifiedReturnBlock, label %cond_true51
cond_true51: ; preds = %cond_next48 cond_true51: ; preds = %cond_next48
%tmp52 = tail call int (...)* %bar( ) ; <int> [#uses=0] %tmp52 = tail call i32 (...)* @bar( ) ; <i32> [#uses=0]
ret void ret void
UnifiedReturnBlock: ; preds = %cond_next48 UnifiedReturnBlock: ; preds = %cond_next48
ret void ret void
} }
declare int %bar(...) declare i32 @bar(...)

View File

@ -1,44 +1,45 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \ ; RUN: llvm-as < %s | llc -march=ppc32 | \
; RUN: grep {stwbrx\\|lwbrx\\|sthbrx\\|lhbrx} | count 4 ; RUN: grep {stwbrx\\|lwbrx\\|sthbrx\\|lhbrx} | count 4
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep rlwinm ; RUN: llvm-as < %s | llc -march=ppc32 | not grep rlwinm
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep rlwimi ; RUN: llvm-as < %s | llc -march=ppc32 | not grep rlwimi
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | \ ; RUN: llvm-as < %s | llc -march=ppc64 | \
; RUN: grep {stwbrx\\|lwbrx\\|sthbrx\\|lhbrx} | count 4 ; RUN: grep {stwbrx\\|lwbrx\\|sthbrx\\|lhbrx} | count 4
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | not grep rlwinm ; RUN: llvm-as < %s | llc -march=ppc64 | not grep rlwinm
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc64 | not grep rlwimi ; RUN: llvm-as < %s | llc -march=ppc64 | not grep rlwimi
void %STWBRX(uint %i, sbyte* %ptr, int %off) { define void @STWBRX(i32 %i, i8* %ptr, i32 %off) {
%tmp1 = getelementptr sbyte* %ptr, int %off %tmp1 = getelementptr i8* %ptr, i32 %off ; <i8*> [#uses=1]
%tmp1 = cast sbyte* %tmp1 to uint* %tmp1.upgrd.1 = bitcast i8* %tmp1 to i32* ; <i32*> [#uses=1]
%tmp13 = tail call uint %llvm.bswap.i32(uint %i) %tmp13 = tail call i32 @llvm.bswap.i32( i32 %i ) ; <i32> [#uses=1]
store uint %tmp13, uint* %tmp1 store i32 %tmp13, i32* %tmp1.upgrd.1
ret void ret void
} }
uint %LWBRX(sbyte* %ptr, int %off) { define i32 @LWBRX(i8* %ptr, i32 %off) {
%tmp1 = getelementptr sbyte* %ptr, int %off %tmp1 = getelementptr i8* %ptr, i32 %off ; <i8*> [#uses=1]
%tmp1 = cast sbyte* %tmp1 to uint* %tmp1.upgrd.2 = bitcast i8* %tmp1 to i32* ; <i32*> [#uses=1]
%tmp = load uint* %tmp1 %tmp = load i32* %tmp1.upgrd.2 ; <i32> [#uses=1]
%tmp14 = tail call uint %llvm.bswap.i32( uint %tmp ) %tmp14 = tail call i32 @llvm.bswap.i32( i32 %tmp ) ; <i32> [#uses=1]
ret uint %tmp14 ret i32 %tmp14
} }
void %STHBRX(ushort %s, sbyte* %ptr, int %off) { define void @STHBRX(i16 %s, i8* %ptr, i32 %off) {
%tmp1 = getelementptr sbyte* %ptr, int %off %tmp1 = getelementptr i8* %ptr, i32 %off ; <i8*> [#uses=1]
%tmp1 = cast sbyte* %tmp1 to ushort* %tmp1.upgrd.3 = bitcast i8* %tmp1 to i16* ; <i16*> [#uses=1]
%tmp5 = call ushort %llvm.bswap.i16( ushort %s ) %tmp5 = call i16 @llvm.bswap.i16( i16 %s ) ; <i16> [#uses=1]
store ushort %tmp5, ushort* %tmp1 store i16 %tmp5, i16* %tmp1.upgrd.3
ret void ret void
} }
ushort %LHBRX(sbyte* %ptr, int %off) { define i16 @LHBRX(i8* %ptr, i32 %off) {
%tmp1 = getelementptr sbyte* %ptr, int %off %tmp1 = getelementptr i8* %ptr, i32 %off ; <i8*> [#uses=1]
%tmp1 = cast sbyte* %tmp1 to ushort* %tmp1.upgrd.4 = bitcast i8* %tmp1 to i16* ; <i16*> [#uses=1]
%tmp = load ushort* %tmp1 %tmp = load i16* %tmp1.upgrd.4 ; <i16> [#uses=1]
%tmp6 = call ushort %llvm.bswap.i16(ushort %tmp) %tmp6 = call i16 @llvm.bswap.i16( i16 %tmp ) ; <i16> [#uses=1]
ret ushort %tmp6 ret i16 %tmp6
} }
declare uint %llvm.bswap.i32(uint) declare i32 @llvm.bswap.i32(i32)
declare i16 @llvm.bswap.i16(i16)
declare ushort %llvm.bswap.i16(ushort)

View File

@ -1,27 +1,26 @@
; There should be exactly one vxor here. ; There should be exactly one vxor here.
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc32 -mcpu=g5 --enable-unsafe-fp-math | \ ; RUN: llc -march=ppc32 -mcpu=g5 --enable-unsafe-fp-math | \
; RUN: grep vxor | count 1 ; RUN: grep vxor | count 1
; There should be exactly one vsplti here. ; There should be exactly one vsplti here.
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=ppc32 -mcpu=g5 --enable-unsafe-fp-math | \ ; RUN: llc -march=ppc32 -mcpu=g5 --enable-unsafe-fp-math | \
; RUN: grep vsplti | count 1 ; RUN: grep vsplti | count 1
define void @VXOR(<4 x float>* %P1, <4 x i32>* %P2, <4 x float>* %P3) {
void %VXOR(<4 x float>* %P1, <4 x int>* %P2, <4 x float>* %P3) { %tmp = load <4 x float>* %P3 ; <<4 x float>> [#uses=1]
%tmp = load <4 x float>* %P3 %tmp3 = load <4 x float>* %P1 ; <<4 x float>> [#uses=1]
%tmp3 = load <4 x float>* %P1 %tmp4 = mul <4 x float> %tmp, %tmp3 ; <<4 x float>> [#uses=1]
%tmp4 = mul <4 x float> %tmp, %tmp3
store <4 x float> %tmp4, <4 x float>* %P3 store <4 x float> %tmp4, <4 x float>* %P3
store <4 x float> zeroinitializer, <4 x float>* %P1 store <4 x float> zeroinitializer, <4 x float>* %P1
store <4 x int> zeroinitializer, <4 x int>* %P2 store <4 x i32> zeroinitializer, <4 x i32>* %P2
ret void ret void
} }
void %VSPLTI(<4 x int>* %P2, <8 x short>* %P3) { define void @VSPLTI(<4 x i32>* %P2, <8 x i16>* %P3) {
store <4 x int> cast (<16 x sbyte> < sbyte -1, sbyte -1, sbyte -1, sbyte -1, sbyte -1, sbyte -1, sbyte -1, sbyte -1, sbyte -1, sbyte -1, sbyte -1, sbyte -1, sbyte -1, sbyte -1, sbyte -1, sbyte -1 > to <4 x int>), <4 x int>* %P2 store <4 x i32> bitcast (<16 x i8> < i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1, i8 -1 > to <4 x i32>), <4 x i32>* %P2
store <8 x short> < short -1, short -1, short -1, short -1, short -1, short -1, short -1, short -1 >, <8 x short>* %P3 store <8 x i16> < i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1, i16 -1 >, <8 x i16>* %P3
ret void ret void
} }

View File

@ -1,31 +1,32 @@
; Test various forms of calls. ; Test various forms of calls.
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \ ; RUN: llvm-as < %s | llc -march=ppc32 | \
; RUN: grep {bl } | count 2 ; RUN: grep {bl } | count 2
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \ ; RUN: llvm-as < %s | llc -march=ppc32 | \
; RUN: grep {bctrl} | count 1 ; RUN: grep {bctrl} | count 1
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | \ ; RUN: llvm-as < %s | llc -march=ppc32 | \
; RUN: grep {bla } | count 1 ; RUN: grep {bla } | count 1
declare void %foo() declare void @foo()
void %test_direct() { define void @test_direct() {
call void %foo() call void @foo( )
ret void ret void
} }
void %test_extsym(sbyte *%P) { define void @test_extsym(i8* %P) {
free sbyte* %P free i8* %P
ret void ret void
} }
void %test_indirect(void()* %fp) { define void @test_indirect(void ()* %fp) {
call void %fp() call void %fp( )
ret void ret void
} }
void %test_abs() { define void @test_abs() {
%fp = cast int 400 to void()* %fp = inttoptr i32 400 to void ()* ; <void ()*> [#uses=1]
call void %fp() call void %fp( )
ret void ret void
} }

View File

@ -1,15 +1,13 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=ppc32 | not grep mfcr ; RUN: llvm-as < %s | llc -march=ppc32 | not grep mfcr
void %test(long %X) { define void @test(i64 %X) {
%tmp1 = and long %X, 3 ; <long> [#uses=1] %tmp1 = and i64 %X, 3 ; <i64> [#uses=1]
%tmp = setgt long %tmp1, 2 ; <bool> [#uses=1] %tmp = icmp sgt i64 %tmp1, 2 ; <i1> [#uses=1]
br bool %tmp, label %UnifiedReturnBlock, label %cond_true br i1 %tmp, label %UnifiedReturnBlock, label %cond_true
cond_true: ; preds = %0
cond_true: ; preds = %entry tail call void @test( i64 0 )
tail call void %test(long 0)
ret void ret void
UnifiedReturnBlock: ; preds = %0
UnifiedReturnBlock: ; preds = %entry
ret void ret void
} }

View File

@ -1,11 +1,15 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -regalloc=simple ; RUN: llvm-as < %s | llc -march=x86 -regalloc=simple
int %main() { define i32 @main() {
%A = add int 0, 0 ; %A = 0 ; %A = 0
%B = add int 0, 1 ; %B = 1 %A = add i32 0, 0 ; <i32> [#uses=1]
; %B = 1
%B = add i32 0, 1 ; <i32> [#uses=2]
br label %bb1 br label %bb1
bb1: bb1: ; preds = %0
%X = mul int %A, %B ; %X = 0*1 = 0 ; %X = 0*1 = 0
%R = sub int %B, 1 ; %r = 0 %X = mul i32 %A, %B ; <i32> [#uses=0]
ret int %R ; %r = 0
%R = sub i32 %B, 1 ; <i32> [#uses=1]
ret i32 %R
} }

View File

@ -1,7 +1,7 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -regalloc=simple ; RUN: llvm-as < %s | llc -march=x86 -regalloc=simple
int %main(int %B) { define i32 @main(i32 %B) {
;%B = add int 0, 1 ;%B = add i32 0, 1;
%R = sub int %B, 1 ; %r = 0 %R = sub i32 %B, 1 ; %r = 0
ret int %R ret i32 %R
} }

View File

@ -3,13 +3,16 @@
; it makes a ton of annoying overlapping live ranges. This code should not ; it makes a ton of annoying overlapping live ranges. This code should not
; cause spills! ; cause spills!
; ;
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -stats |& not grep spilled ; RUN: llvm-as < %s | llc -march=x86 -stats |& not grep spilled
target endian = little target datalayout = "e-p:32:32"
target pointersize = 32
int %test(int, int, int, int, int, int, int, int, int, int) { ret int 0 } define i32 @test(i32, i32, i32, i32, i32, i32, i32, i32, i32, i32) {
int %main() { ret i32 0
%X = call int %test(int 1, int 2, int 3, int 4, int 5, int 6, int 7, int 8, int 9, int 10)
ret int %X
} }
define i32 @main() {
%X = call i32 @test( i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8, i32 9, i32 10 ) ; <i32> [#uses=1]
ret i32 %X
}

View File

@ -1,13 +1,12 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 ; RUN: llvm-as < %s | llc -march=x86
implementation define i32 @test() {
entry:
int %test() { ret i32 7
entry: ret int 7 Test: ; No predecessors!
Test: ; dead block! %A = call i32 @test( ) ; <i32> [#uses=1]
%A = call int %test() %B = call i32 @test( ) ; <i32> [#uses=1]
%B = call int %test() %C = add i32 %A, %B ; <i32> [#uses=1]
%C = add int %A, %B ret i32 %C
ret int %C
} }

View File

@ -1,5 +1,4 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | \ ; RUN: llvm-as < %s | llc -march=x86 | \
; RUN: not grep {.byte\[\[:space:\]\]*true} ; RUN: not grep {.byte\[\[:space:\]\]*true}
%X = global bool true @X = global i1 true ; <i1*> [#uses=0]

View File

@ -1,14 +1,16 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep {(%esp} ; RUN: llvm-as < %s | llc -march=x86 | grep {(%esp}
declare sbyte* %llvm.returnaddress(uint) declare i8* @llvm.returnaddress(i32)
declare sbyte* %llvm.frameaddress(uint)
sbyte *%test1() { declare i8* @llvm.frameaddress(i32)
%X = call sbyte* %llvm.returnaddress(uint 0)
ret sbyte* %X define i8* @test1() {
%X = call i8* @llvm.returnaddress( i32 0 ) ; <i8*> [#uses=1]
ret i8* %X
} }
sbyte *%test2() { define i8* @test2() {
%X = call sbyte* %llvm.frameaddress(uint 0) %X = call i8* @llvm.frameaddress( i32 0 ) ; <i8*> [#uses=1]
ret sbyte* %X ret i8* %X
} }

View File

@ -1,5 +1,5 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep -i ESP | not grep sub ; RUN: llvm-as < %s | llc -march=x86 | grep -i ESP | not grep sub
int %test(int %X) { define i32 @test(i32 %X) {
ret int %X ret i32 %X
} }

View File

@ -1,11 +1,12 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 ; RUN: llvm-as < %s | llc -march=x86
define i1 @test1(double %X) {
bool %test1(double %X) { %V = fcmp one double %X, 0.000000e+00 ; <i1> [#uses=1]
%V = cast double %X to bool ret i1 %V
ret bool %V
} }
double %test2(ulong %X) { define double @test2(i64 %X) {
%V = cast ulong %X to double %V = uitofp i64 %X to double ; <double> [#uses=1]
ret double %V ret double %V
} }

View File

@ -1,7 +1,8 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep {j\[lgbe\]} ; RUN: llvm-as < %s | llc -march=x86 | not grep {j\[lgbe\]}
int %max(int %A, int %B) { define i32 @max(i32 %A, i32 %B) {
%gt = setgt int %A, %B %gt = icmp sgt i32 %A, %B ; <i1> [#uses=1]
%R = select bool %gt, int %A, int %B %R = select i1 %gt, i32 %A, i32 %B ; <i32> [#uses=1]
ret int %R ret i32 %R
} }

View File

@ -2,11 +2,12 @@
; overlapping live intervals. When two overlapping intervals have the same ; overlapping live intervals. When two overlapping intervals have the same
; value, they can be joined though. ; value, they can be joined though.
; ;
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -regalloc=linearscan | \ ; RUN: llvm-as < %s | llc -march=x86 -regalloc=linearscan | \
; RUN: not grep {mov %\[A-Z\]\\\{2,3\\\}, %\[A-Z\]\\\{2,3\\\}} ; RUN: not grep {mov %\[A-Z\]\\\{2,3\\\}, %\[A-Z\]\\\{2,3\\\}}
long %test(long %x) { define i64 @test(i64 %x) {
entry: entry:
%tmp.1 = mul long %x, 4294967297 ; <long> [#uses=1] %tmp.1 = mul i64 %x, 4294967297 ; <i64> [#uses=1]
ret long %tmp.1 ret i64 %tmp.1
} }

View File

@ -1,8 +1,7 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 ; RUN: llvm-as < %s | llc -march=x86
implementation ; Functions: define double @test(double %d) {
%X = select i1 false, double %d, double %d ; <double> [#uses=1]
double %test(double %d) { ret double %X
%X = select bool false, double %d, double %d ; <double> [#uses=0]
ret double %X
} }

View File

@ -1,6 +1,6 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 ; RUN: llvm-as < %s | llc -march=x86
bool %T(double %X) { define i1 @T(double %X) {
%V = seteq double %X, %X %V = fcmp oeq double %X, %X ; <i1> [#uses=1]
ret bool %V ret i1 %V
} }

View File

@ -1,8 +1,8 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 ; RUN: llvm-as < %s | llc -march=x86
bool %test(bool %C, bool %D, int %X, int %Y) { define i1 @test(i1 %C, i1 %D, i32 %X, i32 %Y) {
%E = setlt int %X, %Y %E = icmp slt i32 %X, %Y ; <i1> [#uses=1]
%F = select bool %C, bool %D, bool %E %F = select i1 %C, i1 %D, i1 %E ; <i1> [#uses=1]
ret bool %F ret i1 %F
} }

View File

@ -3,14 +3,15 @@
; is invalid code (there is no correct way to order the instruction). Check ; is invalid code (there is no correct way to order the instruction). Check
; that we do not fold the load into the sub. ; that we do not fold the load into the sub.
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep sub.*GLOBAL ; RUN: llvm-as < %s | llc -march=x86 | not grep sub.*GLOBAL
%GLOBAL = external global int @GLOBAL = external global i32 ; <i32*> [#uses=1]
int %test(int* %P1, int* %P2, int* %P3) { define i32 @test(i32* %P1, i32* %P2, i32* %P3) {
%L = load int* %GLOBAL %L = load i32* @GLOBAL ; <i32> [#uses=1]
store int 12, int* %P2 store i32 12, i32* %P2
%Y = load int* %P3 %Y = load i32* %P3 ; <i32> [#uses=1]
%Z = sub int %Y, %L %Z = sub i32 %Y, %L ; <i32> [#uses=1]
ret int %Z ret i32 %Z
} }

View File

@ -1,5 +1,5 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep 18446744073709551612 ; RUN: llvm-as < %s | llc -march=x86 | not grep 18446744073709551612
%A = external global int @A = external global i32 ; <i32*> [#uses=1]
@Y = global i32* getelementptr (i32* @A, i32 -1) ; <i32**> [#uses=0]
%Y = global int* getelementptr (int* %A, int -1)

View File

@ -1,49 +1,38 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=generic ; RUN: llvm-as < %s | llc -march=x86 -mcpu=generic
; Make sure LLC doesn't crash in the stackifier due to FP PHI nodes. ; Make sure LLC doesn't crash in the stackifier due to FP PHI nodes.
void %radfg_() { define void @radfg_() {
entry: entry:
br bool false, label %no_exit.16.preheader, label %loopentry.0 br i1 false, label %no_exit.16.preheader, label %loopentry.0
loopentry.0: ; preds = %entry
loopentry.0: ; preds = %entry ret void
ret void no_exit.16.preheader: ; preds = %entry
br label %no_exit.16
no_exit.16.preheader: ; preds = %entry no_exit.16: ; preds = %no_exit.16, %no_exit.16.preheader
br label %no_exit.16 br i1 false, label %loopexit.16.loopexit, label %no_exit.16
loopexit.16.loopexit: ; preds = %no_exit.16
no_exit.16: ; preds = %no_exit.16, %no_exit.16.preheader br label %no_exit.18
br bool false, label %loopexit.16.loopexit, label %no_exit.16 no_exit.18: ; preds = %loopexit.20, %loopexit.16.loopexit
%tmp.882 = add float 0.000000e+00, 0.000000e+00 ; <float> [#uses=2]
loopexit.16.loopexit: ; preds = %no_exit.16 br i1 false, label %loopexit.19, label %no_exit.19.preheader
br label %no_exit.18 no_exit.19.preheader: ; preds = %no_exit.18
ret void
no_exit.18: ; preds = %loopexit.20, %loopexit.16.loopexit loopexit.19: ; preds = %no_exit.18
%tmp.882 = add float 0.000000e+00, 0.000000e+00 ; <float> [#uses=2] br i1 false, label %loopexit.20, label %no_exit.20
br bool false, label %loopexit.19, label %no_exit.19.preheader no_exit.20: ; preds = %loopexit.21, %loopexit.19
%ai2.1122.tmp.3 = phi float [ %tmp.958, %loopexit.21 ], [ %tmp.882, %loopexit.19 ] ; <float> [#uses=1]
no_exit.19.preheader: ; preds = %no_exit.18 %tmp.950 = mul float %tmp.882, %ai2.1122.tmp.3 ; <float> [#uses=1]
ret void %tmp.951 = sub float 0.000000e+00, %tmp.950 ; <float> [#uses=1]
%tmp.958 = add float 0.000000e+00, 0.000000e+00 ; <float> [#uses=1]
loopexit.19: ; preds = %no_exit.18 br i1 false, label %loopexit.21, label %no_exit.21.preheader
br bool false, label %loopexit.20, label %no_exit.20 no_exit.21.preheader: ; preds = %no_exit.20
ret void
no_exit.20: ; preds = %loopexit.21, %loopexit.19 loopexit.21: ; preds = %no_exit.20
%ai2.1122.tmp.3 = phi float [ %tmp.958, %loopexit.21 ], [ %tmp.882, %loopexit.19 ] ; <float> [#uses=1] br i1 false, label %loopexit.20, label %no_exit.20
%tmp.950 = mul float %tmp.882, %ai2.1122.tmp.3 ; <float> [#uses=1] loopexit.20: ; preds = %loopexit.21, %loopexit.19
%tmp.951 = sub float 0.000000e+00, %tmp.950 ; <float> [#uses=1] %ar2.1124.tmp.2 = phi float [ 0.000000e+00, %loopexit.19 ], [ %tmp.951, %loopexit.21 ] ; <float> [#uses=0]
%tmp.958 = add float 0.000000e+00, 0.000000e+00 ; <float> [#uses=1] br i1 false, label %loopexit.18.loopexit, label %no_exit.18
br bool false, label %loopexit.21, label %no_exit.21.preheader loopexit.18.loopexit: ; preds = %loopexit.20
ret void
no_exit.21.preheader: ; preds = %no_exit.20
ret void
loopexit.21: ; preds = %no_exit.20
br bool false, label %loopexit.20, label %no_exit.20
loopexit.20: ; preds = %loopexit.21, %loopexit.19
%ar2.1124.tmp.2 = phi float [ 0.000000e+00, %loopexit.19 ], [ %tmp.951, %loopexit.21 ] ; <float> [#uses=0]
br bool false, label %loopexit.18.loopexit, label %no_exit.18
loopexit.18.loopexit: ; preds = %loopexit.20
ret void
} }

View File

@ -1,16 +1,20 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | \ ; RUN: llvm-as < %s | llc -march=x86 | \
; RUN: grep shld | count 1 ; RUN: grep shld | count 1
; ;
; Check that the isel does not fold the shld, which already folds a load ; Check that the isel does not fold the shld, which already folds a load
; and has two uses, into a store. ; and has two uses, into a store.
%A = external global uint
uint %test5(uint %B, ubyte %C) { @A = external global i32 ; <i32*> [#uses=2]
%tmp.1 = load uint *%A;
%tmp.2 = shl uint %tmp.1, ubyte %C define i32 @test5(i32 %B, i8 %C) {
%tmp.3 = sub ubyte 32, %C %tmp.1 = load i32* @A ; <i32> [#uses=1]
%tmp.4 = shr uint %B, ubyte %tmp.3 %shift.upgrd.1 = zext i8 %C to i32 ; <i32> [#uses=1]
%tmp.5 = or uint %tmp.4, %tmp.2 %tmp.2 = shl i32 %tmp.1, %shift.upgrd.1 ; <i32> [#uses=1]
store uint %tmp.5, uint* %A %tmp.3 = sub i8 32, %C ; <i8> [#uses=1]
ret uint %tmp.5 %shift.upgrd.2 = zext i8 %tmp.3 to i32 ; <i32> [#uses=1]
%tmp.4 = lshr i32 %B, %shift.upgrd.2 ; <i32> [#uses=1]
%tmp.5 = or i32 %tmp.4, %tmp.2 ; <i32> [#uses=2]
store i32 %tmp.5, i32* @A
ret i32 %tmp.5
} }

View File

@ -1,11 +1,12 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | not grep {subl.*%esp} ; RUN: llvm-as < %s | llc -march=x86 | not grep {subl.*%esp}
int %f(int %a, int %b) { define i32 @f(i32 %a, i32 %b) {
%tmp.2 = mul int %a, %a %tmp.2 = mul i32 %a, %a ; <i32> [#uses=1]
%tmp.5 = shl int %a, ubyte 1 %tmp.5 = shl i32 %a, 1 ; <i32> [#uses=1]
%tmp.6 = mul int %tmp.5, %b %tmp.6 = mul i32 %tmp.5, %b ; <i32> [#uses=1]
%tmp.10 = mul int %b, %b %tmp.10 = mul i32 %b, %b ; <i32> [#uses=1]
%tmp.7 = add int %tmp.10, %tmp.2 %tmp.7 = add i32 %tmp.10, %tmp.2 ; <i32> [#uses=1]
%tmp.11 = add int %tmp.7, %tmp.6 %tmp.11 = add i32 %tmp.7, %tmp.6 ; <i32> [#uses=1]
ret int %tmp.11 ret i32 %tmp.11
} }

View File

@ -1,11 +1,12 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -stats |& \ ; RUN: llvm-as < %s | llc -march=x86 -stats |& \
; RUN: grep asm-printer | grep 7 ; RUN: grep asm-printer | grep 7
int %g(int %a, int %b) { define i32 @g(i32 %a, i32 %b) {
%tmp.1 = shl int %b, ubyte 1 %tmp.1 = shl i32 %b, 1 ; <i32> [#uses=1]
%tmp.3 = add int %tmp.1, %a %tmp.3 = add i32 %tmp.1, %a ; <i32> [#uses=1]
%tmp.5 = mul int %tmp.3, %a %tmp.5 = mul i32 %tmp.3, %a ; <i32> [#uses=1]
%tmp.8 = mul int %b, %b %tmp.8 = mul i32 %b, %b ; <i32> [#uses=1]
%tmp.9 = add int %tmp.5, %tmp.8 %tmp.9 = add i32 %tmp.5, %tmp.8 ; <i32> [#uses=1]
ret int %tmp.9 ret i32 %tmp.9
} }

View File

@ -1,55 +1,50 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=yonah ; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah
; END.
target endian = little target datalayout = "e-p:32:32"
target pointersize = 32
target triple = "i686-apple-darwin8.6.1" target triple = "i686-apple-darwin8.6.1"
%struct.GLTColor4 = type { float, float, float, float } %struct.GLTColor4 = type { float, float, float, float }
%struct.GLTCoord3 = type { float, float, float } %struct.GLTCoord3 = type { float, float, float }
%struct.__GLIContextRec = type { { %struct.anon, { [24 x [16 x float]], [24 x [16 x float]] }, %struct.GLTColor4, { float, float, float, float, %struct.GLTCoord3, float } }, { float, float, float, float, float, float, float, float, [4 x uint], [4 x uint], [4 x uint] } } %struct.__GLIContextRec = type { { %struct.anon, { [24 x [16 x float]], [24 x [16 x float]] }, %struct.GLTColor4, { float, float, float, float, %struct.GLTCoord3, float } }, { float, float, float, float, float, float, float, float, [4 x i32], [4 x i32], [4 x i32] } }
%struct.__GLvertex = type { %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTCoord3, float, %struct.GLTColor4, float, float, float, ubyte, ubyte, ubyte, ubyte, [4 x float], [2 x sbyte*], uint, uint, [16 x %struct.GLTColor4] } %struct.__GLvertex = type { %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTColor4, %struct.GLTCoord3, float, %struct.GLTColor4, float, float, float, i8, i8, i8, i8, [4 x float], [2 x i8*], i32, i32, [16 x %struct.GLTColor4] }
%struct.anon = type { float, float, float, float, float, float, float, float } %struct.anon = type { float, float, float, float, float, float, float, float }
implementation ; Functions: declare <4 x float> @llvm.x86.sse.cmp.ps(<4 x float>, <4 x float>, i8)
declare <4 x float> %llvm.x86.sse.cmp.ps(<4 x float>, <4 x float>, sbyte) declare <4 x i32> @llvm.x86.sse2.packssdw.128(<4 x i32>, <4 x i32>)
declare <4 x int> %llvm.x86.sse2.packssdw.128(<4 x int>, <4 x int>) declare i32 @llvm.x86.sse2.pmovmskb.128(<16 x i8>)
declare int %llvm.x86.sse2.pmovmskb.128(<16 x sbyte>) define void @gleLLVMVecInterpolateClip() {
void %gleLLVMVecInterpolateClip() {
entry: entry:
br bool false, label %cond_false, label %cond_false183 br i1 false, label %cond_false, label %cond_false183
cond_false: ; preds = %entry cond_false: ; preds = %entry
br bool false, label %cond_false183, label %cond_true69 br i1 false, label %cond_false183, label %cond_true69
cond_true69: ; preds = %cond_false cond_true69: ; preds = %cond_false
ret void ret void
cond_false183: ; preds = %cond_false, %entry cond_false183: ; preds = %cond_false, %entry
%vuizmsk.0.1 = phi <4 x int> [ < int -1, int -1, int -1, int 0 >, %entry ], [ < int -1, int 0, int 0, int 0 >, %cond_false ] ; <<4 x int>> [#uses=2] %vuizmsk.0.1 = phi <4 x i32> [ < i32 -1, i32 -1, i32 -1, i32 0 >, %entry ], [ < i32 -1, i32 0, i32 0, i32 0 >, %cond_false ] ; <<4 x i32>> [#uses=2]
%tmp192 = extractelement <4 x int> %vuizmsk.0.1, uint 2 ; <int> [#uses=1] %tmp192 = extractelement <4 x i32> %vuizmsk.0.1, i32 2 ; <i32> [#uses=1]
%tmp193 = extractelement <4 x int> %vuizmsk.0.1, uint 3 ; <int> [#uses=2] %tmp193 = extractelement <4 x i32> %vuizmsk.0.1, i32 3 ; <i32> [#uses=2]
%tmp195 = insertelement <4 x int> zeroinitializer, int %tmp192, uint 1 ; <<4 x int>> [#uses=1] %tmp195 = insertelement <4 x i32> zeroinitializer, i32 %tmp192, i32 1 ; <<4 x i32>> [#uses=1]
%tmp196 = insertelement <4 x int> %tmp195, int %tmp193, uint 2 ; <<4 x int>> [#uses=1] %tmp196 = insertelement <4 x i32> %tmp195, i32 %tmp193, i32 2 ; <<4 x i32>> [#uses=1]
%tmp197 = insertelement <4 x int> %tmp196, int %tmp193, uint 3 ; <<4 x int>> [#uses=1] %tmp197 = insertelement <4 x i32> %tmp196, i32 %tmp193, i32 3 ; <<4 x i32>> [#uses=1]
%tmp336 = and <4 x int> zeroinitializer, %tmp197 ; <<4 x int>> [#uses=1] %tmp336 = and <4 x i32> zeroinitializer, %tmp197 ; <<4 x i32>> [#uses=1]
%tmp337 = cast <4 x int> %tmp336 to <4 x float> ; <<4 x float>> [#uses=1] %tmp337 = bitcast <4 x i32> %tmp336 to <4 x float> ; <<4 x float>> [#uses=1]
%tmp378 = tail call <4 x float> %llvm.x86.sse.cmp.ps( <4 x float> %tmp337, <4 x float> zeroinitializer, sbyte 1 ) ; <<4 x float>> [#uses=1] %tmp378 = tail call <4 x float> @llvm.x86.sse.cmp.ps( <4 x float> %tmp337, <4 x float> zeroinitializer, i8 1 ) ; <<4 x float>> [#uses=1]
%tmp379 = cast <4 x float> %tmp378 to <4 x int> ; <<4 x int>> [#uses=1] %tmp379 = bitcast <4 x float> %tmp378 to <4 x i32> ; <<4 x i32>> [#uses=1]
%tmp388 = tail call <4 x int> %llvm.x86.sse2.packssdw.128( <4 x int> zeroinitializer, <4 x int> %tmp379 ) ; <<4 x int>> [#uses=1] %tmp388 = tail call <4 x i32> @llvm.x86.sse2.packssdw.128( <4 x i32> zeroinitializer, <4 x i32> %tmp379 ) ; <<4 x i32>> [#uses=1]
%tmp392 = cast <4 x int> %tmp388 to <8 x short> ; <<8 x short>> [#uses=1] %tmp392 = bitcast <4 x i32> %tmp388 to <8 x i16> ; <<8 x i16>> [#uses=1]
%tmp399 = extractelement <8 x short> %tmp392, uint 7 ; <short> [#uses=1] %tmp399 = extractelement <8 x i16> %tmp392, i32 7 ; <i16> [#uses=1]
%tmp423 = insertelement <8 x short> zeroinitializer, short %tmp399, uint 7 ; <<8 x short>> [#uses=1] %tmp423 = insertelement <8 x i16> zeroinitializer, i16 %tmp399, i32 7 ; <<8 x i16>> [#uses=1]
%tmp427 = cast <8 x short> %tmp423 to <16 x sbyte> ; <<16 x sbyte>> [#uses=1] %tmp427 = bitcast <8 x i16> %tmp423 to <16 x i8> ; <<16 x i8>> [#uses=1]
%tmp428 = tail call int %llvm.x86.sse2.pmovmskb.128( <16 x sbyte> %tmp427 ) ; <int> [#uses=1] %tmp428 = tail call i32 @llvm.x86.sse2.pmovmskb.128( <16 x i8> %tmp427 ) ; <i32> [#uses=1]
%tmp432 = cast int %tmp428 to sbyte ; <sbyte> [#uses=1] %tmp432 = trunc i32 %tmp428 to i8 ; <i8> [#uses=1]
%tmp = and sbyte %tmp432, 42 ; <sbyte> [#uses=1] %tmp = and i8 %tmp432, 42 ; <i8> [#uses=1]
%tmp436 = cast sbyte %tmp to ubyte ; <ubyte> [#uses=1] %tmp436 = bitcast i8 %tmp to i8 ; <i8> [#uses=1]
%tmp446 = cast ubyte %tmp436 to uint ; <uint> [#uses=1] %tmp446 = zext i8 %tmp436 to i32 ; <i32> [#uses=1]
%tmp447 = shl uint %tmp446, ubyte 24 ; <uint> [#uses=1] %tmp447 = shl i32 %tmp446, 24 ; <i32> [#uses=1]
%tmp449 = or uint 0, %tmp447 ; <uint> [#uses=1] %tmp449 = or i32 0, %tmp447 ; <i32> [#uses=1]
store uint %tmp449, uint* null store i32 %tmp449, i32* null
ret void ret void
} }

View File

@ -1,36 +1,32 @@
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=x86 -mtriple=i686-apple-darwin8 -relocation-model=static | \ ; RUN: llc -march=x86 -mtriple=i686-apple-darwin8 -relocation-model=static | \
; RUN: grep {movl _last} | count 1 ; RUN: grep {movl _last} | count 1
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=x86 -mtriple=i686-apple-darwin8 -relocation-model=static | \ ; RUN: llc -march=x86 -mtriple=i686-apple-darwin8 -relocation-model=static | \
; RUN: grep {cmpl.*_last} | count 1 ; RUN: grep {cmpl.*_last} | count 1
%block = external global ubyte* ; <ubyte**> [#uses=1] @block = external global i8* ; <i8**> [#uses=1]
%last = external global int ; <int*> [#uses=3] @last = external global i32 ; <i32*> [#uses=3]
implementation ; Functions: define i1 @loadAndRLEsource_no_exit_2E_1_label_2E_0(i32 %tmp.21.reload, i32 %tmp.8) {
bool %loadAndRLEsource_no_exit_2E_1_label_2E_0(int %tmp.21.reload, int %tmp.8) {
newFuncRoot: newFuncRoot:
br label %label.0 br label %label.0
label.0.no_exit.1_crit_edge.exitStub: ; preds = %label.0
label.0.no_exit.1_crit_edge.exitStub: ; preds = %label.0 ret i1 true
ret bool true codeRepl5.exitStub: ; preds = %label.0
ret i1 false
codeRepl5.exitStub: ; preds = %label.0 label.0: ; preds = %newFuncRoot
ret bool false %tmp.35 = load i32* @last ; <i32> [#uses=1]
%inc.1 = add i32 %tmp.35, 1 ; <i32> [#uses=2]
label.0: ; preds = %newFuncRoot store i32 %inc.1, i32* @last
%tmp.35 = load int* %last ; <int> [#uses=1] %tmp.36 = load i8** @block ; <i8*> [#uses=1]
%inc.1 = add int %tmp.35, 1 ; <int> [#uses=2] %tmp.38 = getelementptr i8* %tmp.36, i32 %inc.1 ; <i8*> [#uses=1]
store int %inc.1, int* %last %tmp.40 = trunc i32 %tmp.21.reload to i8 ; <i8> [#uses=1]
%tmp.36 = load ubyte** %block ; <ubyte*> [#uses=1] store i8 %tmp.40, i8* %tmp.38
%tmp.38 = getelementptr ubyte* %tmp.36, int %inc.1 ; <ubyte*> [#uses=1] %tmp.910 = load i32* @last ; <i32> [#uses=1]
%tmp.40 = cast int %tmp.21.reload to ubyte ; <ubyte> [#uses=1] %tmp.1111 = icmp slt i32 %tmp.910, %tmp.8 ; <i1> [#uses=1]
store ubyte %tmp.40, ubyte* %tmp.38 %tmp.1412 = icmp ne i32 %tmp.21.reload, 257 ; <i1> [#uses=1]
%tmp.910 = load int* %last ; <int> [#uses=1] %tmp.1613 = and i1 %tmp.1111, %tmp.1412 ; <i1> [#uses=1]
%tmp.1111 = setlt int %tmp.910, %tmp.8 ; <bool> [#uses=1] br i1 %tmp.1613, label %label.0.no_exit.1_crit_edge.exitStub, label %codeRepl5.exitStub
%tmp.1412 = setne int %tmp.21.reload, 257 ; <bool> [#uses=1]
%tmp.1613 = and bool %tmp.1111, %tmp.1412 ; <bool> [#uses=1]
br bool %tmp.1613, label %label.0.no_exit.1_crit_edge.exitStub, label %codeRepl5.exitStub
} }

View File

@ -1,74 +1,76 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mcpu=yonah -stats |& \ ; RUN: llvm-as < %s | llc -march=x86 -mcpu=yonah -stats |& \
; RUN: not grep {Number of register spills} ; RUN: not grep {Number of register spills}
; END.
int %foo(<4 x float>* %a, <4 x float>* %b, <4 x float>* %c, <4 x float>* %d) {
define i32 @foo(<4 x float>* %a, <4 x float>* %b, <4 x float>* %c, <4 x float>* %d) {
%tmp44 = load <4 x float>* %a ; <<4 x float>> [#uses=9] %tmp44 = load <4 x float>* %a ; <<4 x float>> [#uses=9]
%tmp46 = load <4 x float>* %b ; <<4 x float>> [#uses=1] %tmp46 = load <4 x float>* %b ; <<4 x float>> [#uses=1]
%tmp48 = load <4 x float>* %c ; <<4 x float>> [#uses=1] %tmp48 = load <4 x float>* %c ; <<4 x float>> [#uses=1]
%tmp50 = load <4 x float>* %d ; <<4 x float>> [#uses=1] %tmp50 = load <4 x float>* %d ; <<4 x float>> [#uses=1]
%tmp51 = cast <4 x float> %tmp44 to <4 x int> ; <<4 x int>> [#uses=1] %tmp51 = bitcast <4 x float> %tmp44 to <4 x i32> ; <<4 x i32>> [#uses=1]
%tmp = shufflevector <4 x int> %tmp51, <4 x int> undef, <4 x uint> < uint 3, uint 3, uint 3, uint 3 > ; <<4 x int>> [#uses=2] %tmp = shufflevector <4 x i32> %tmp51, <4 x i32> undef, <4 x i32> < i32 3, i32 3, i32 3, i32 3 > ; <<4 x i32>> [#uses=2]
%tmp52 = cast <4 x int> %tmp to <4 x float> ; <<4 x float>> [#uses=1] %tmp52 = bitcast <4 x i32> %tmp to <4 x float> ; <<4 x float>> [#uses=1]
%tmp60 = xor <4 x int> %tmp, < int -2147483648, int -2147483648, int -2147483648, int -2147483648 > ; <<4 x int>> [#uses=1] %tmp60 = xor <4 x i32> %tmp, < i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648 > ; <<4 x i32>> [#uses=1]
%tmp61 = cast <4 x int> %tmp60 to <4 x float> ; <<4 x float>> [#uses=1] %tmp61 = bitcast <4 x i32> %tmp60 to <4 x float> ; <<4 x float>> [#uses=1]
%tmp74 = tail call <4 x float> %llvm.x86.sse.cmp.ps( <4 x float> %tmp52, <4 x float> %tmp44, sbyte 1 ) ; <<4 x float>> [#uses=1] %tmp74 = tail call <4 x float> @llvm.x86.sse.cmp.ps( <4 x float> %tmp52, <4 x float> %tmp44, i8 1 ) ; <<4 x float>> [#uses=1]
%tmp75 = cast <4 x float> %tmp74 to <4 x int> ; <<4 x int>> [#uses=1] %tmp75 = bitcast <4 x float> %tmp74 to <4 x i32> ; <<4 x i32>> [#uses=1]
%tmp88 = tail call <4 x float> %llvm.x86.sse.cmp.ps( <4 x float> %tmp44, <4 x float> %tmp61, sbyte 1 ) ; <<4 x float>> [#uses=1] %tmp88 = tail call <4 x float> @llvm.x86.sse.cmp.ps( <4 x float> %tmp44, <4 x float> %tmp61, i8 1 ) ; <<4 x float>> [#uses=1]
%tmp89 = cast <4 x float> %tmp88 to <4 x int> ; <<4 x int>> [#uses=1] %tmp89 = bitcast <4 x float> %tmp88 to <4 x i32> ; <<4 x i32>> [#uses=1]
%tmp98 = tail call <4 x int> %llvm.x86.sse2.packssdw.128( <4 x int> %tmp75, <4 x int> %tmp89 ) ; <<4 x int>> [#uses=1] %tmp98 = tail call <4 x i32> @llvm.x86.sse2.packssdw.128( <4 x i32> %tmp75, <4 x i32> %tmp89 ) ; <<4 x i32>> [#uses=1]
%tmp102 = cast <4 x int> %tmp98 to <8 x short> ; <<8 x short>> [#uses=1] %tmp102 = bitcast <4 x i32> %tmp98 to <8 x i16> ; <<8 x i16>> [#uses=1]
%tmp = shufflevector <8 x short> %tmp102, <8 x short> undef, <8 x uint> < uint 0, uint 1, uint 2, uint 3, uint 6, uint 5, uint 4, uint 7 > ; <<8 x short>> [#uses=1] %tmp.upgrd.1 = shufflevector <8 x i16> %tmp102, <8 x i16> undef, <8 x i32> < i32 0, i32 1, i32 2, i32 3, i32 6, i32 5, i32 4, i32 7 > ; <<8 x i16>> [#uses=1]
%tmp105 = shufflevector <8 x short> %tmp, <8 x short> undef, <8 x uint> < uint 2, uint 1, uint 0, uint 3, uint 4, uint 5, uint 6, uint 7 > ; <<8 x short>> [#uses=1] %tmp105 = shufflevector <8 x i16> %tmp.upgrd.1, <8 x i16> undef, <8 x i32> < i32 2, i32 1, i32 0, i32 3, i32 4, i32 5, i32 6, i32 7 > ; <<8 x i16>> [#uses=1]
%tmp105 = cast <8 x short> %tmp105 to <4 x float> ; <<4 x float>> [#uses=1] %tmp105.upgrd.2 = bitcast <8 x i16> %tmp105 to <4 x float> ; <<4 x float>> [#uses=1]
store <4 x float> %tmp105, <4 x float>* %a store <4 x float> %tmp105.upgrd.2, <4 x float>* %a
%tmp108 = cast <4 x float> %tmp46 to <4 x int> ; <<4 x int>> [#uses=1] %tmp108 = bitcast <4 x float> %tmp46 to <4 x i32> ; <<4 x i32>> [#uses=1]
%tmp109 = shufflevector <4 x int> %tmp108, <4 x int> undef, <4 x uint> < uint 3, uint 3, uint 3, uint 3 > ; <<4 x int>> [#uses=2] %tmp109 = shufflevector <4 x i32> %tmp108, <4 x i32> undef, <4 x i32> < i32 3, i32 3, i32 3, i32 3 > ; <<4 x i32>> [#uses=2]
%tmp109 = cast <4 x int> %tmp109 to <4 x float> ; <<4 x float>> [#uses=1] %tmp109.upgrd.3 = bitcast <4 x i32> %tmp109 to <4 x float> ; <<4 x float>> [#uses=1]
%tmp119 = xor <4 x int> %tmp109, < int -2147483648, int -2147483648, int -2147483648, int -2147483648 > ; <<4 x int>> [#uses=1] %tmp119 = xor <4 x i32> %tmp109, < i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648 > ; <<4 x i32>> [#uses=1]
%tmp120 = cast <4 x int> %tmp119 to <4 x float> ; <<4 x float>> [#uses=1] %tmp120 = bitcast <4 x i32> %tmp119 to <4 x float> ; <<4 x float>> [#uses=1]
%tmp133 = tail call <4 x float> %llvm.x86.sse.cmp.ps( <4 x float> %tmp109, <4 x float> %tmp44, sbyte 1 ) ; <<4 x float>> [#uses=1] %tmp133 = tail call <4 x float> @llvm.x86.sse.cmp.ps( <4 x float> %tmp109.upgrd.3, <4 x float> %tmp44, i8 1 ) ; <<4 x float>> [#uses=1]
%tmp134 = cast <4 x float> %tmp133 to <4 x int> ; <<4 x int>> [#uses=1] %tmp134 = bitcast <4 x float> %tmp133 to <4 x i32> ; <<4 x i32>> [#uses=1]
%tmp147 = tail call <4 x float> %llvm.x86.sse.cmp.ps( <4 x float> %tmp44, <4 x float> %tmp120, sbyte 1 ) ; <<4 x float>> [#uses=1] %tmp147 = tail call <4 x float> @llvm.x86.sse.cmp.ps( <4 x float> %tmp44, <4 x float> %tmp120, i8 1 ) ; <<4 x float>> [#uses=1]
%tmp148 = cast <4 x float> %tmp147 to <4 x int> ; <<4 x int>> [#uses=1] %tmp148 = bitcast <4 x float> %tmp147 to <4 x i32> ; <<4 x i32>> [#uses=1]
%tmp159 = tail call <4 x int> %llvm.x86.sse2.packssdw.128( <4 x int> %tmp134, <4 x int> %tmp148 ) ; <<4 x int>> [#uses=1] %tmp159 = tail call <4 x i32> @llvm.x86.sse2.packssdw.128( <4 x i32> %tmp134, <4 x i32> %tmp148 ) ; <<4 x i32>> [#uses=1]
%tmp163 = cast <4 x int> %tmp159 to <8 x short> ; <<8 x short>> [#uses=1] %tmp163 = bitcast <4 x i32> %tmp159 to <8 x i16> ; <<8 x i16>> [#uses=1]
%tmp164 = shufflevector <8 x short> %tmp163, <8 x short> undef, <8 x uint> < uint 0, uint 1, uint 2, uint 3, uint 6, uint 5, uint 4, uint 7 > ; <<8 x short>> [#uses=1] %tmp164 = shufflevector <8 x i16> %tmp163, <8 x i16> undef, <8 x i32> < i32 0, i32 1, i32 2, i32 3, i32 6, i32 5, i32 4, i32 7 > ; <<8 x i16>> [#uses=1]
%tmp166 = shufflevector <8 x short> %tmp164, <8 x short> undef, <8 x uint> < uint 2, uint 1, uint 0, uint 3, uint 4, uint 5, uint 6, uint 7 > ; <<8 x short>> [#uses=1] %tmp166 = shufflevector <8 x i16> %tmp164, <8 x i16> undef, <8 x i32> < i32 2, i32 1, i32 0, i32 3, i32 4, i32 5, i32 6, i32 7 > ; <<8 x i16>> [#uses=1]
%tmp166 = cast <8 x short> %tmp166 to <4 x float> ; <<4 x float>> [#uses=1] %tmp166.upgrd.4 = bitcast <8 x i16> %tmp166 to <4 x float> ; <<4 x float>> [#uses=1]
store <4 x float> %tmp166, <4 x float>* %b store <4 x float> %tmp166.upgrd.4, <4 x float>* %b
%tmp169 = cast <4 x float> %tmp48 to <4 x int> ; <<4 x int>> [#uses=1] %tmp169 = bitcast <4 x float> %tmp48 to <4 x i32> ; <<4 x i32>> [#uses=1]
%tmp170 = shufflevector <4 x int> %tmp169, <4 x int> undef, <4 x uint> < uint 3, uint 3, uint 3, uint 3 > ; <<4 x int>> [#uses=2] %tmp170 = shufflevector <4 x i32> %tmp169, <4 x i32> undef, <4 x i32> < i32 3, i32 3, i32 3, i32 3 > ; <<4 x i32>> [#uses=2]
%tmp170 = cast <4 x int> %tmp170 to <4 x float> ; <<4 x float>> [#uses=1] %tmp170.upgrd.5 = bitcast <4 x i32> %tmp170 to <4 x float> ; <<4 x float>> [#uses=1]
%tmp180 = xor <4 x int> %tmp170, < int -2147483648, int -2147483648, int -2147483648, int -2147483648 > ; <<4 x int>> [#uses=1] %tmp180 = xor <4 x i32> %tmp170, < i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648 > ; <<4 x i32>> [#uses=1]
%tmp181 = cast <4 x int> %tmp180 to <4 x float> ; <<4 x float>> [#uses=1] %tmp181 = bitcast <4 x i32> %tmp180 to <4 x float> ; <<4 x float>> [#uses=1]
%tmp194 = tail call <4 x float> %llvm.x86.sse.cmp.ps( <4 x float> %tmp170, <4 x float> %tmp44, sbyte 1 ) ; <<4 x float>> [#uses=1] %tmp194 = tail call <4 x float> @llvm.x86.sse.cmp.ps( <4 x float> %tmp170.upgrd.5, <4 x float> %tmp44, i8 1 ) ; <<4 x float>> [#uses=1]
%tmp195 = cast <4 x float> %tmp194 to <4 x int> ; <<4 x int>> [#uses=1] %tmp195 = bitcast <4 x float> %tmp194 to <4 x i32> ; <<4 x i32>> [#uses=1]
%tmp208 = tail call <4 x float> %llvm.x86.sse.cmp.ps( <4 x float> %tmp44, <4 x float> %tmp181, sbyte 1 ) ; <<4 x float>> [#uses=1] %tmp208 = tail call <4 x float> @llvm.x86.sse.cmp.ps( <4 x float> %tmp44, <4 x float> %tmp181, i8 1 ) ; <<4 x float>> [#uses=1]
%tmp209 = cast <4 x float> %tmp208 to <4 x int> ; <<4 x int>> [#uses=1] %tmp209 = bitcast <4 x float> %tmp208 to <4 x i32> ; <<4 x i32>> [#uses=1]
%tmp220 = tail call <4 x int> %llvm.x86.sse2.packssdw.128( <4 x int> %tmp195, <4 x int> %tmp209 ) ; <<4 x int>> [#uses=1] %tmp220 = tail call <4 x i32> @llvm.x86.sse2.packssdw.128( <4 x i32> %tmp195, <4 x i32> %tmp209 ) ; <<4 x i32>> [#uses=1]
%tmp224 = cast <4 x int> %tmp220 to <8 x short> ; <<8 x short>> [#uses=1] %tmp224 = bitcast <4 x i32> %tmp220 to <8 x i16> ; <<8 x i16>> [#uses=1]
%tmp225 = shufflevector <8 x short> %tmp224, <8 x short> undef, <8 x uint> < uint 0, uint 1, uint 2, uint 3, uint 6, uint 5, uint 4, uint 7 > ; <<8 x short>> [#uses=1] %tmp225 = shufflevector <8 x i16> %tmp224, <8 x i16> undef, <8 x i32> < i32 0, i32 1, i32 2, i32 3, i32 6, i32 5, i32 4, i32 7 > ; <<8 x i16>> [#uses=1]
%tmp227 = shufflevector <8 x short> %tmp225, <8 x short> undef, <8 x uint> < uint 2, uint 1, uint 0, uint 3, uint 4, uint 5, uint 6, uint 7 > ; <<8 x short>> [#uses=1] %tmp227 = shufflevector <8 x i16> %tmp225, <8 x i16> undef, <8 x i32> < i32 2, i32 1, i32 0, i32 3, i32 4, i32 5, i32 6, i32 7 > ; <<8 x i16>> [#uses=1]
%tmp227 = cast <8 x short> %tmp227 to <4 x float> ; <<4 x float>> [#uses=1] %tmp227.upgrd.6 = bitcast <8 x i16> %tmp227 to <4 x float> ; <<4 x float>> [#uses=1]
store <4 x float> %tmp227, <4 x float>* %c store <4 x float> %tmp227.upgrd.6, <4 x float>* %c
%tmp230 = cast <4 x float> %tmp50 to <4 x int> ; <<4 x int>> [#uses=1] %tmp230 = bitcast <4 x float> %tmp50 to <4 x i32> ; <<4 x i32>> [#uses=1]
%tmp231 = shufflevector <4 x int> %tmp230, <4 x int> undef, <4 x uint> < uint 3, uint 3, uint 3, uint 3 > ; <<4 x int>> [#uses=2] %tmp231 = shufflevector <4 x i32> %tmp230, <4 x i32> undef, <4 x i32> < i32 3, i32 3, i32 3, i32 3 > ; <<4 x i32>> [#uses=2]
%tmp231 = cast <4 x int> %tmp231 to <4 x float> ; <<4 x float>> [#uses=1] %tmp231.upgrd.7 = bitcast <4 x i32> %tmp231 to <4 x float> ; <<4 x float>> [#uses=1]
%tmp241 = xor <4 x int> %tmp231, < int -2147483648, int -2147483648, int -2147483648, int -2147483648 > ; <<4 x int>> [#uses=1] %tmp241 = xor <4 x i32> %tmp231, < i32 -2147483648, i32 -2147483648, i32 -2147483648, i32 -2147483648 > ; <<4 x i32>> [#uses=1]
%tmp242 = cast <4 x int> %tmp241 to <4 x float> ; <<4 x float>> [#uses=1] %tmp242 = bitcast <4 x i32> %tmp241 to <4 x float> ; <<4 x float>> [#uses=1]
%tmp255 = tail call <4 x float> %llvm.x86.sse.cmp.ps( <4 x float> %tmp231, <4 x float> %tmp44, sbyte 1 ) ; <<4 x float>> [#uses=1] %tmp255 = tail call <4 x float> @llvm.x86.sse.cmp.ps( <4 x float> %tmp231.upgrd.7, <4 x float> %tmp44, i8 1 ) ; <<4 x float>> [#uses=1]
%tmp256 = cast <4 x float> %tmp255 to <4 x int> ; <<4 x int>> [#uses=1] %tmp256 = bitcast <4 x float> %tmp255 to <4 x i32> ; <<4 x i32>> [#uses=1]
%tmp269 = tail call <4 x float> %llvm.x86.sse.cmp.ps( <4 x float> %tmp44, <4 x float> %tmp242, sbyte 1 ) ; <<4 x float>> [#uses=1] %tmp269 = tail call <4 x float> @llvm.x86.sse.cmp.ps( <4 x float> %tmp44, <4 x float> %tmp242, i8 1 ) ; <<4 x float>> [#uses=1]
%tmp270 = cast <4 x float> %tmp269 to <4 x int> ; <<4 x int>> [#uses=1] %tmp270 = bitcast <4 x float> %tmp269 to <4 x i32> ; <<4 x i32>> [#uses=1]
%tmp281 = tail call <4 x int> %llvm.x86.sse2.packssdw.128( <4 x int> %tmp256, <4 x int> %tmp270 ) ; <<4 x int>> [#uses=1] %tmp281 = tail call <4 x i32> @llvm.x86.sse2.packssdw.128( <4 x i32> %tmp256, <4 x i32> %tmp270 ) ; <<4 x i32>> [#uses=1]
%tmp285 = cast <4 x int> %tmp281 to <8 x short> ; <<8 x short>> [#uses=1] %tmp285 = bitcast <4 x i32> %tmp281 to <8 x i16> ; <<8 x i16>> [#uses=1]
%tmp286 = shufflevector <8 x short> %tmp285, <8 x short> undef, <8 x uint> < uint 0, uint 1, uint 2, uint 3, uint 6, uint 5, uint 4, uint 7 > ; <<8 x short>> [#uses=1] %tmp286 = shufflevector <8 x i16> %tmp285, <8 x i16> undef, <8 x i32> < i32 0, i32 1, i32 2, i32 3, i32 6, i32 5, i32 4, i32 7 > ; <<8 x i16>> [#uses=1]
%tmp288 = shufflevector <8 x short> %tmp286, <8 x short> undef, <8 x uint> < uint 2, uint 1, uint 0, uint 3, uint 4, uint 5, uint 6, uint 7 > ; <<8 x short>> [#uses=1] %tmp288 = shufflevector <8 x i16> %tmp286, <8 x i16> undef, <8 x i32> < i32 2, i32 1, i32 0, i32 3, i32 4, i32 5, i32 6, i32 7 > ; <<8 x i16>> [#uses=1]
%tmp288 = cast <8 x short> %tmp288 to <4 x float> ; <<4 x float>> [#uses=1] %tmp288.upgrd.8 = bitcast <8 x i16> %tmp288 to <4 x float> ; <<4 x float>> [#uses=1]
store <4 x float> %tmp288, <4 x float>* %d store <4 x float> %tmp288.upgrd.8, <4 x float>* %d
ret int 0 ret i32 0
} }
declare <4 x float> %llvm.x86.sse.cmp.ps(<4 x float>, <4 x float>, sbyte) declare <4 x float> @llvm.x86.sse.cmp.ps(<4 x float>, <4 x float>, i8)
declare <4 x int> %llvm.x86.sse2.packssdw.128(<4 x int>, <4 x int>) declare <4 x i32> @llvm.x86.sse2.packssdw.128(<4 x i32>, <4 x i32>)

View File

@ -1,23 +1,24 @@
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=x86 -relocation-model=static -stats |& \ ; RUN: llc -march=x86 -relocation-model=static -stats |& \
; RUN: grep asm-printer | grep 14 ; RUN: grep asm-printer | grep 14
; ;
%size20 = external global uint ; <uint*> [#uses=1] @size20 = external global i32 ; <i32*> [#uses=1]
%in5 = external global ubyte* ; <ubyte**> [#uses=1] @in5 = external global i8* ; <i8**> [#uses=1]
int %compare(sbyte* %a, sbyte* %b) { define i32 @compare(i8* %a, i8* %b) {
%tmp = cast sbyte* %a to uint* ; <uint*> [#uses=1] %tmp = bitcast i8* %a to i32* ; <i32*> [#uses=1]
%tmp1 = cast sbyte* %b to uint* ; <uint*> [#uses=1] %tmp1 = bitcast i8* %b to i32* ; <i32*> [#uses=1]
%tmp = load uint* %size20 ; <uint> [#uses=1] %tmp.upgrd.1 = load i32* @size20 ; <i32> [#uses=1]
%tmp = load ubyte** %in5 ; <ubyte*> [#uses=2] %tmp.upgrd.2 = load i8** @in5 ; <i8*> [#uses=2]
%tmp3 = load uint* %tmp1 ; <uint> [#uses=1] %tmp3 = load i32* %tmp1 ; <i32> [#uses=1]
%tmp4 = getelementptr ubyte* %tmp, uint %tmp3 ; <ubyte*> [#uses=1] %gep.upgrd.3 = zext i32 %tmp3 to i64 ; <i64> [#uses=1]
%tmp7 = load uint* %tmp ; <uint> [#uses=1] %tmp4 = getelementptr i8* %tmp.upgrd.2, i64 %gep.upgrd.3 ; <i8*> [#uses=2]
%tmp8 = getelementptr ubyte* %tmp, uint %tmp7 ; <ubyte*> [#uses=1] %tmp7 = load i32* %tmp ; <i32> [#uses=1]
%tmp8 = cast ubyte* %tmp8 to sbyte* ; <sbyte*> [#uses=1] %gep.upgrd.4 = zext i32 %tmp7 to i64 ; <i64> [#uses=1]
%tmp4 = cast ubyte* %tmp4 to sbyte* ; <sbyte*> [#uses=1] %tmp8 = getelementptr i8* %tmp.upgrd.2, i64 %gep.upgrd.4 ; <i8*> [#uses=2]
%tmp = tail call int %memcmp( sbyte* %tmp8, sbyte* %tmp4, uint %tmp ) ; <int> [#uses=1] %tmp.upgrd.5 = tail call i32 @memcmp( i8* %tmp8, i8* %tmp4, i32 %tmp.upgrd.1 ) ; <i32> [#uses=1]
ret int %tmp ret i32 %tmp.upgrd.5
} }
declare int %memcmp(sbyte*, sbyte*, uint) declare i32 @memcmp(i8*, i8*, i32)

View File

@ -1,25 +1,24 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -stats |& \ ; RUN: llvm-as < %s | llc -march=x86 -stats |& \
; RUN: grep asm-printer | grep 13 ; RUN: grep asm-printer | grep 13
void %_ZN9__gnu_cxx9hashtableISt4pairIKPKciES3_NS_4hashIS3_EESt10_Select1stIS5_E5eqstrSaIiEE14find_or_insertERKS5__cond_true456.i(sbyte* %tmp435.i, uint* %tmp449.i.out) { define void @_ZN9__gnu_cxx9hashtableISt4pairIKPKciES3_NS_4hashIS3_EESt10_Select1stIS5_E5eqstrSaIiEE14find_or_insertERKS5__cond_true456.i(i8* %tmp435.i, i32* %tmp449.i.out) {
newFuncRoot: newFuncRoot:
br label %cond_true456.i br label %cond_true456.i
bb459.i.exitStub: ; preds = %cond_true456.i bb459.i.exitStub: ; preds = %cond_true456.i
store uint %tmp449.i, uint* %tmp449.i.out store i32 %tmp449.i, i32* %tmp449.i.out
ret void ret void
cond_true456.i: ; preds = %cond_true456.i, %newFuncRoot cond_true456.i: ; preds = %cond_true456.i, %newFuncRoot
%__s441.2.4.i = phi sbyte* [ %tmp451.i, %cond_true456.i ], [ %tmp435.i, %newFuncRoot ] ; <sbyte*> [#uses=2] %__s441.2.4.i = phi i8* [ %tmp451.i.upgrd.1, %cond_true456.i ], [ %tmp435.i, %newFuncRoot ] ; <i8*> [#uses=2]
%__h.2.4.i = phi uint [ %tmp449.i, %cond_true456.i ], [ 0, %newFuncRoot ] ; <uint> [#uses=1] %__h.2.4.i = phi i32 [ %tmp449.i, %cond_true456.i ], [ 0, %newFuncRoot ] ; <i32> [#uses=1]
%tmp446.i = mul uint %__h.2.4.i, 5 ; <uint> [#uses=1] %tmp446.i = mul i32 %__h.2.4.i, 5 ; <i32> [#uses=1]
%tmp.i = load sbyte* %__s441.2.4.i ; <sbyte> [#uses=1] %tmp.i = load i8* %__s441.2.4.i ; <i8> [#uses=1]
%tmp448.i = cast sbyte %tmp.i to uint ; <uint> [#uses=1] %tmp448.i = sext i8 %tmp.i to i32 ; <i32> [#uses=1]
%tmp449.i = add uint %tmp448.i, %tmp446.i ; <uint> [#uses=2] %tmp449.i = add i32 %tmp448.i, %tmp446.i ; <i32> [#uses=2]
%tmp450.i = cast sbyte* %__s441.2.4.i to uint ; <uint> [#uses=1] %tmp450.i = ptrtoint i8* %__s441.2.4.i to i32 ; <i32> [#uses=1]
%tmp451.i = add uint %tmp450.i, 1 ; <uint> [#uses=1] %tmp451.i = add i32 %tmp450.i, 1 ; <i32> [#uses=1]
%tmp451.i = cast uint %tmp451.i to sbyte* ; <sbyte*> [#uses=2] %tmp451.i.upgrd.1 = inttoptr i32 %tmp451.i to i8* ; <i8*> [#uses=2]
%tmp45435.i = load sbyte* %tmp451.i ; <sbyte> [#uses=1] %tmp45435.i = load i8* %tmp451.i.upgrd.1 ; <i8> [#uses=1]
%tmp45536.i = seteq sbyte %tmp45435.i, 0 ; <bool> [#uses=1] %tmp45536.i = icmp eq i8 %tmp45435.i, 0 ; <i1> [#uses=1]
br bool %tmp45536.i, label %bb459.i.exitStub, label %cond_true456.i br i1 %tmp45536.i, label %bb459.i.exitStub, label %cond_true456.i
} }

View File

@ -1,23 +1,25 @@
; Coalescing from R32 to a subset R32_. Once another register coalescer bug is ; Coalescing from R32 to a subset R32_. Once another register coalescer bug is
; fixed, the movb should go away as well. ; fixed, the movb should go away as well.
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -relocation-model=static | \ ; RUN: llvm-as < %s | llc -march=x86 -relocation-model=static | \
; RUN: grep movl ; RUN: grep movl
%B = external global uint @B = external global i32 ; <i32*> [#uses=2]
%C = external global ushort* @C = external global i16* ; <i16**> [#uses=2]
void %test(uint %A) { define void @test(i32 %A) {
%A = cast uint %A to ubyte %A.upgrd.1 = trunc i32 %A to i8 ; <i8> [#uses=1]
%tmp2 = load uint* %B %tmp2 = load i32* @B ; <i32> [#uses=1]
%tmp3 = and ubyte %A, 16 %tmp3 = and i8 %A.upgrd.1, 16 ; <i8> [#uses=1]
%tmp4 = shl uint %tmp2, ubyte %tmp3 %shift.upgrd.2 = zext i8 %tmp3 to i32 ; <i32> [#uses=1]
store uint %tmp4, uint* %B %tmp4 = shl i32 %tmp2, %shift.upgrd.2 ; <i32> [#uses=1]
%tmp6 = shr uint %A, ubyte 3 store i32 %tmp4, i32* @B
%tmp = load ushort** %C %tmp6 = lshr i32 %A, 3 ; <i32> [#uses=1]
%tmp8 = cast ushort* %tmp to uint %tmp = load i16** @C ; <i16*> [#uses=1]
%tmp9 = add uint %tmp8, %tmp6 %tmp8 = ptrtoint i16* %tmp to i32 ; <i32> [#uses=1]
%tmp9 = cast uint %tmp9 to ushort* %tmp9 = add i32 %tmp8, %tmp6 ; <i32> [#uses=1]
store ushort* %tmp9, ushort** %C %tmp9.upgrd.3 = inttoptr i32 %tmp9 to i16* ; <i16*> [#uses=1]
store i16* %tmp9.upgrd.3, i16** @C
ret void ret void
} }

View File

@ -1,23 +1,26 @@
; RUN: llvm-upgrade < %s | llvm-as | \ ; RUN: llvm-as < %s | \
; RUN: llc -march=x86 -relocation-model=static | not grep {subl.*%esp} ; RUN: llc -march=x86 -relocation-model=static | not grep {subl.*%esp}
%A = external global ushort* @A = external global i16* ; <i16**> [#uses=1]
%B = external global uint @B = external global i32 ; <i32*> [#uses=1]
%C = external global uint @C = external global i32 ; <i32*> [#uses=2]
void %test() { define void @test() {
%tmp = load ushort** %A %tmp = load i16** @A ; <i16*> [#uses=1]
%tmp1 = getelementptr ushort* %tmp, int 1 %tmp1 = getelementptr i16* %tmp, i32 1 ; <i16*> [#uses=1]
%tmp = load ushort* %tmp1 %tmp.upgrd.1 = load i16* %tmp1 ; <i16> [#uses=1]
%tmp3 = cast ushort %tmp to uint %tmp3 = zext i16 %tmp.upgrd.1 to i32 ; <i32> [#uses=1]
%tmp = load uint* %B %tmp.upgrd.2 = load i32* @B ; <i32> [#uses=1]
%tmp4 = and uint %tmp, 16 %tmp4 = and i32 %tmp.upgrd.2, 16 ; <i32> [#uses=1]
%tmp5 = load uint* %C %tmp5 = load i32* @C ; <i32> [#uses=1]
%tmp6 = cast uint %tmp4 to ubyte %tmp6 = trunc i32 %tmp4 to i8 ; <i8> [#uses=2]
%tmp7 = shl uint %tmp5, ubyte %tmp6 %shift.upgrd.3 = zext i8 %tmp6 to i32 ; <i32> [#uses=1]
%tmp9 = xor ubyte %tmp6, 16 %tmp7 = shl i32 %tmp5, %shift.upgrd.3 ; <i32> [#uses=1]
%tmp11 = shr uint %tmp3, ubyte %tmp9 %tmp9 = xor i8 %tmp6, 16 ; <i8> [#uses=1]
%tmp12 = or uint %tmp11, %tmp7 %shift.upgrd.4 = zext i8 %tmp9 to i32 ; <i32> [#uses=1]
store uint %tmp12, uint* %C %tmp11 = lshr i32 %tmp3, %shift.upgrd.4 ; <i32> [#uses=1]
%tmp12 = or i32 %tmp11, %tmp7 ; <i32> [#uses=1]
store i32 %tmp12, i32* @C
ret void ret void
} }

View File

@ -1,14 +1,15 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -mattr=+sse2 ; RUN: llvm-as < %s | llc -march=x86 -mattr=+sse2
<4 x float> %opRSQ(<4 x float> %a) { define <4 x float> @opRSQ(<4 x float> %a) {
entry: entry:
%tmp2 = extractelement <4 x float> %a, uint 3 %tmp2 = extractelement <4 x float> %a, i32 3 ; <float> [#uses=2]
%abscond = setge float %tmp2, -0.000000e+00 %abscond = fcmp oge float %tmp2, -0.000000e+00 ; <i1> [#uses=1]
%abs = select bool %abscond, float %tmp2, float 0.000000e+00 %abs = select i1 %abscond, float %tmp2, float 0.000000e+00 ; <float> [#uses=1]
%tmp3 = tail call float %llvm.sqrt.f32( float %abs ) %tmp3 = tail call float @llvm.sqrt.f32( float %abs ) ; <float> [#uses=1]
%tmp4 = div float 1.000000e+00, %tmp3 %tmp4 = fdiv float 1.000000e+00, %tmp3 ; <float> [#uses=1]
%tmp11 = insertelement <4 x float> zeroinitializer, float %tmp4, uint 3 %tmp11 = insertelement <4 x float> zeroinitializer, float %tmp4, i32 3 ; <<4 x float>> [#uses=1]
ret <4 x float> %tmp11 ret <4 x float> %tmp11
} }
declare float %llvm.sqrt.f32(float) declare float @llvm.sqrt.f32(float)

View File

@ -1,9 +1,10 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep setnp ; RUN: llvm-as < %s | llc -march=x86 | grep setnp
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -enable-unsafe-fp-math | \ ; RUN: llvm-as < %s | llc -march=x86 -enable-unsafe-fp-math | \
; RUN: not grep setnp ; RUN: not grep setnp
uint %test(float %f) { define i32 @test(float %f) {
%tmp = seteq float %f, 0.000000e+00 %tmp = fcmp oeq float %f, 0.000000e+00 ; <i1> [#uses=1]
%tmp = cast bool %tmp to uint %tmp.upgrd.1 = zext i1 %tmp to i32 ; <i32> [#uses=1]
ret uint %tmp ret i32 %tmp.upgrd.1
} }

View File

@ -1,21 +1,20 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 ; RUN: llvm-as < %s | llc -march=x86
int %test() { define i32 @test() {
br bool false, label %cond_next33, label %cond_true12 br i1 false, label %cond_next33, label %cond_true12
cond_true12: ; preds = %0
cond_true12: ret i32 0
ret int 0 cond_next33: ; preds = %0
%tmp44.i = call double @foo( double 0.000000e+00, i32 32 ) ; <double> [#uses=1]
cond_next33: %tmp61.i = load i8* null ; <i8> [#uses=1]
%tmp44.i = call double %foo( double 0.000000e+00, int 32 ) %tmp61.i.upgrd.1 = zext i8 %tmp61.i to i32 ; <i32> [#uses=1]
%tmp61.i = load ubyte* null %tmp58.i = or i32 0, %tmp61.i.upgrd.1 ; <i32> [#uses=1]
%tmp61.i = cast ubyte %tmp61.i to int %tmp62.i = or i32 %tmp58.i, 0 ; <i32> [#uses=1]
%tmp58.i = or int 0, %tmp61.i %tmp62.i.upgrd.2 = sitofp i32 %tmp62.i to double ; <double> [#uses=1]
%tmp62.i = or int %tmp58.i, 0 %tmp64.i = add double %tmp62.i.upgrd.2, %tmp44.i ; <double> [#uses=1]
%tmp62.i = cast int %tmp62.i to double %tmp68.i = call double @foo( double %tmp64.i, i32 0 ) ; <double> [#uses=0]
%tmp64.i = add double %tmp62.i, %tmp44.i ret i32 0
%tmp68.i = call double %foo( double %tmp64.i, int 0 )
ret int 0
} }
declare double %foo(double, int) declare double @foo(double, i32)

View File

@ -1,7 +1,8 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 ; RUN: llvm-as < %s | llc -march=x86
; PR825 ; PR825
long %test() { define i64 @test() {
%tmp.i5 = call long asm sideeffect "rdtsc", "=A,~{dirflag},~{fpsr},~{flags}"( ) ; <long> [#uses=0] %tmp.i5 = call i64 asm sideeffect "rdtsc", "=A,~{dirflag},~{fpsr},~{flags}"( ) ; <i64> [#uses=1]
ret long %tmp.i5 ret i64 %tmp.i5
} }

View File

@ -1,18 +1,12 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 ; RUN: llvm-as < %s | llc -march=x86
; PR828 ; PR828
target endian = little target datalayout = "e-p:32:32"
target pointersize = 32
target triple = "i686-pc-linux-gnu" target triple = "i686-pc-linux-gnu"
implementation ; Functions: define void @_ZN5() {
cond_true9:
void %_ZN5() { %tmp3.i.i = call i32 asm sideeffect "lock; cmpxchg $1,$2", "={ax},q,m,0,~{dirflag},~{fpsr},~{flags},~{memory}"( i32 0, i32* null, i32 0 ) ; <i32> [#uses=0]
ret void
cond_true9: ; preds = %entry
%tmp3.i.i = call int asm sideeffect "lock; cmpxchg $1,$2",
"={ax},q,m,0,~{dirflag},~{fpsr},~{flags},~{memory}"( int 0, int* null, int 0 )
; <int> [#uses=0]
ret void
} }

View File

@ -1,51 +1,48 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=att ; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=att
; PR834 ; PR834
; END.
target endian = little target datalayout = "e-p:32:32"
target pointersize = 32
target triple = "i386-unknown-freebsd6.1" target triple = "i386-unknown-freebsd6.1"
%llvm.dbg.anchor.type = type { i32, i32 }
%llvm.dbg.anchor.type = type { uint, uint } %llvm.dbg.basictype.type = type { i32, { }*, i8*, { }*, i32, i64, i64, i64, i32, i32 }
%llvm.dbg.basictype.type = type { uint, { }*, sbyte*, { }*, uint, ulong, ulong, ulong, uint, uint } %llvm.dbg.compile_unit.type = type { i32, { }*, i32, i8*, i8*, i8* }
%llvm.dbg.compile_unit.type = type { uint, { }*, uint, sbyte*, sbyte*, sbyte* } %llvm.dbg.global_variable.type = type { i32, { }*, { }*, i8*, i8*, { }*, i32, { }*, i1, i1, { }* }
%llvm.dbg.global_variable.type = type { uint, { }*, { }*, sbyte*, sbyte*, { }*, uint, { }*, bool, bool, { }* } @x = global i32 0 ; <i32*> [#uses=1]
%x = global int 0 ; <int*> [#uses=1] @llvm.dbg.global_variable = internal constant %llvm.dbg.global_variable.type {
%llvm.dbg.global_variable = internal constant %llvm.dbg.global_variable.type { i32 327732,
uint 327732, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.global_variables to { }*),
{ }* cast (%llvm.dbg.anchor.type* %llvm.dbg.global_variables to { }*), { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*),
{ }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), i8* getelementptr ([2 x i8]* @str, i64 0, i64 0),
sbyte* getelementptr ([2 x sbyte]* %str, int 0, int 0), i8* null,
sbyte* null, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*),
{ }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), i32 1,
uint 1, { }* bitcast (%llvm.dbg.basictype.type* @llvm.dbg.basictype to { }*),
{ }* cast (%llvm.dbg.basictype.type* %llvm.dbg.basictype to { }*), i1 false,
bool false, i1 true,
bool true, { }* bitcast (i32* @x to { }*) }, section "llvm.metadata" ; <%llvm.dbg.global_variable.type*> [#uses=0]
{ }* cast (int* %x to { }*) }, section "llvm.metadata" ; <%llvm.dbg.global_variable.type*> [#uses=0] @llvm.dbg.global_variables = linkonce constant %llvm.dbg.anchor.type { i32 327680, i32 52 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
%llvm.dbg.global_variables = linkonce constant %llvm.dbg.anchor.type { uint 327680, uint 52 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] @llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type {
%llvm.dbg.compile_unit = internal constant %llvm.dbg.compile_unit.type { i32 327697,
uint 327697, { }* bitcast (%llvm.dbg.anchor.type* @llvm.dbg.compile_units to { }*),
{ }* cast (%llvm.dbg.anchor.type* %llvm.dbg.compile_units to { }*), i32 4,
uint 4, i8* getelementptr ([10 x i8]* @str1, i64 0, i64 0),
sbyte* getelementptr ([10 x sbyte]* %str, int 0, int 0), i8* getelementptr ([32 x i8]* @str2, i64 0, i64 0),
sbyte* getelementptr ([32 x sbyte]* %str, int 0, int 0), i8* getelementptr ([45 x i8]* @str3, i64 0, i64 0) }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1]
sbyte* getelementptr ([45 x sbyte]* %str, int 0, int 0) }, section "llvm.metadata" ; <%llvm.dbg.compile_unit.type*> [#uses=1] @llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { i32 327680, i32 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1]
%llvm.dbg.compile_units = linkonce constant %llvm.dbg.anchor.type { uint 327680, uint 17 }, section "llvm.metadata" ; <%llvm.dbg.anchor.type*> [#uses=1] @str1 = internal constant [10 x i8] c"testb.cpp\00", section "llvm.metadata" ; <[10 x i8]*> [#uses=1]
%str = internal constant [10 x sbyte] c"testb.cpp\00", section "llvm.metadata" ; <[10 x sbyte]*> [#uses=1] @str2 = internal constant [32 x i8] c"/Sources/Projects/DwarfTesting/\00", section "llvm.metadata" ; <[32 x i8]*> [#uses=1]
%str = internal constant [32 x sbyte] c"/Sources/Projects/DwarfTesting/\00", section "llvm.metadata" ; <[32 x sbyte]*> [#uses=1] @str3 = internal constant [45 x i8] c"4.0.1 LLVM (Apple Computer, Inc. build 5400)\00", section "llvm.metadata" ; <[45 x i8]*> [#uses=1]
%str = internal constant [45 x sbyte] c"4.0.1 LLVM (Apple Computer, Inc. build 5400)\00", section "llvm.metadata" ; <[45 x sbyte]*> [#uses=1] @str = internal constant [2 x i8] c"x\00", section "llvm.metadata" ; <[2 x i8]*> [#uses=1]
%str = internal constant [2 x sbyte] c"x\00", section "llvm.metadata" ; <[2 x sbyte]*> [#uses=1] @llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type {
%llvm.dbg.basictype = internal constant %llvm.dbg.basictype.type { i32 327716,
uint 327716, { }* bitcast (%llvm.dbg.compile_unit.type* @llvm.dbg.compile_unit to { }*),
{ }* cast (%llvm.dbg.compile_unit.type* %llvm.dbg.compile_unit to { }*), i8* getelementptr ([4 x i8]* @str4, i64 0, i64 0),
sbyte* getelementptr ([4 x sbyte]* %str, int 0, int 0),
{ }* null, { }* null,
uint 0, i32 0,
ulong 32, i64 32,
ulong 32, i64 32,
ulong 0, i64 0,
uint 0, i32 0,
uint 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1] i32 5 }, section "llvm.metadata" ; <%llvm.dbg.basictype.type*> [#uses=1]
%str = internal constant [4 x sbyte] c"int\00", section "llvm.metadata" ; <[4 x sbyte]*> [#uses=1] @str4 = internal constant [4 x i8] c"int\00", section "llvm.metadata" ; <[4 x i8]*> [#uses=1]
implementation ; Functions:

View File

@ -1,24 +1,23 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 ; RUN: llvm-as < %s | llc -march=x86
; PR833 ; PR833
%G = weak global int 0 ; <int*> [#uses=3] @G = weak global i32 0 ; <i32*> [#uses=3]
implementation ; Functions: define i32 @foo(i32 %X) {
int %foo(int %X) {
entry: entry:
%X_addr = alloca int ; <int*> [#uses=3] %X_addr = alloca i32 ; <i32*> [#uses=3]
store int %X, int* %X_addr store i32 %X, i32* %X_addr
call void asm sideeffect "xchg{l} {$0,$1|$1,$0}", "=*m,=*r,m,1,~{dirflag},~{fpsr},~{flags}"( int* %G, int* %X_addr, int* %G, int %X ) call void asm sideeffect "xchg{l} {$0,$1|$1,$0}", "=*m,=*r,m,1,~{dirflag},~{fpsr},~{flags}"( i32* @G, i32* %X_addr, i32* @G, i32 %X )
%tmp1 = load int* %X_addr ; <int> [#uses=1] %tmp1 = load i32* %X_addr ; <i32> [#uses=1]
ret int %tmp1 ret i32 %tmp1
} }
int %foo2(int %X) { define i32 @foo2(i32 %X) {
entry: entry:
%X_addr = alloca int ; <int*> [#uses=3] %X_addr = alloca i32 ; <i32*> [#uses=3]
store int %X, int* %X_addr store i32 %X, i32* %X_addr
call void asm sideeffect "xchg{l} {$0,$1|$1,$0}", "=*m,=*r,1,~{dirflag},~{fpsr},~{flags}"( int* %G, int* %X_addr, int %X ) call void asm sideeffect "xchg{l} {$0,$1|$1,$0}", "=*m,=*r,1,~{dirflag},~{fpsr},~{flags}"( i32* @G, i32* %X_addr, i32 %X )
%tmp1 = load int* %X_addr ; <int> [#uses=1] %tmp1 = load i32* %X_addr ; <i32> [#uses=1]
ret int %tmp1 ret i32 %tmp1
} }

View File

@ -1,5 +1,5 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep -- 4294967240 ; RUN: llvm-as < %s | llc -march=x86 | grep -- 4294967240
; PR853 ; PR853
%X = global int* cast (ulong 18446744073709551560 to int*) @X = global i32* inttoptr (i64 -56 to i32*) ; <i32**> [#uses=0]

View File

@ -1,11 +1,11 @@
; PR850 ; PR850
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=att | \ ; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=att | \
; RUN: grep {movl 4(%eax),%ebp} ; RUN: grep {movl 4(%eax),%ebp}
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=att | \ ; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=att | \
; RUN: grep {movl 0(%eax), %ebx} ; RUN: grep {movl 0(%eax), %ebx}
int %foo(int %__s.i.i, int %tmp5.i.i, int %tmp6.i.i, int %tmp7.i.i, int %tmp8.i.i ) { define i32 @foo(i32 %__s.i.i, i32 %tmp5.i.i, i32 %tmp6.i.i, i32 %tmp7.i.i, i32 %tmp8.i.i) {
%tmp9.i.i = call i32 asm sideeffect "push %ebp\0Apush %ebx\0Amovl 4($2),%ebp\0Amovl 0($2), %ebx\0Amovl $1,%eax\0Aint $$0x80\0Apop %ebx\0Apop %ebp", "={ax},i,0,{cx},{dx},{si},{di}"( i32 192, i32 %__s.i.i, i32 %tmp5.i.i, i32 %tmp6.i.i, i32 %tmp7.i.i, i32 %tmp8.i.i ) ; <i32> [#uses=1]
%tmp9.i.i = call int asm sideeffect "push %ebp\0Apush %ebx\0Amovl 4($2),%ebp\0Amovl 0($2), %ebx\0Amovl $1,%eax\0Aint $$0x80\0Apop %ebx\0Apop %ebp", "={ax},i,0,{cx},{dx},{si},{di}"(int 192, int %__s.i.i, int %tmp5.i.i, int %tmp6.i.i, int %tmp7.i.i, int %tmp8.i.i ) ret i32 %tmp9.i.i
ret int %tmp9.i.i
} }

View File

@ -1,10 +1,11 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 ; RUN: llvm-as < %s | llc -march=x86
void %_ZN13QFSFileEngine4readEPcx() { define void @_ZN13QFSFileEngine4readEPcx() {
%tmp201 = load int* null %tmp201 = load i32* null ; <i32> [#uses=1]
%tmp201 = cast int %tmp201 to long %tmp201.upgrd.1 = sext i32 %tmp201 to i64 ; <i64> [#uses=1]
%tmp202 = load long* null %tmp202 = load i64* null ; <i64> [#uses=1]
%tmp203 = add long %tmp201, %tmp202 %tmp203 = add i64 %tmp201.upgrd.1, %tmp202 ; <i64> [#uses=1]
store long %tmp203, long* null store i64 %tmp203, i64* null
ret void ret void
} }

View File

@ -1,31 +1,28 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep shrl ; RUN: llvm-as < %s | llc -march=x86 | grep shrl
; Bug in FindModifiedNodeSlot cause tmp14 load to become a zextload and shr 31 ; Bug in FindModifiedNodeSlot cause tmp14 load to become a zextload and shr 31
; is then optimized away. ; is then optimized away.
@tree_code_type = external global [0 x i32] ; <[0 x i32]*> [#uses=1]
%tree_code_type = external global [0 x uint] define void @copy_if_shared_r() {
%tmp = load i32* null ; <i32> [#uses=1]
void %copy_if_shared_r() { %tmp56 = and i32 %tmp, 255 ; <i32> [#uses=1]
%tmp = load uint* null %gep.upgrd.1 = zext i32 %tmp56 to i64 ; <i64> [#uses=1]
%tmp56 = and uint %tmp, 255 %tmp8 = getelementptr [0 x i32]* @tree_code_type, i32 0, i64 %gep.upgrd.1 ; <i32*> [#uses=1]
%tmp8 = getelementptr [0 x uint]* %tree_code_type, int 0, uint %tmp56 %tmp9 = load i32* %tmp8 ; <i32> [#uses=1]
%tmp9 = load uint* %tmp8 %tmp10 = add i32 %tmp9, -1 ; <i32> [#uses=1]
%tmp10 = add uint %tmp9, 4294967295 %tmp.upgrd.2 = icmp ugt i32 %tmp10, 2 ; <i1> [#uses=1]
%tmp = setgt uint %tmp10, 2 %tmp14 = load i32* null ; <i32> [#uses=1]
%tmp14 = load uint* null %tmp15 = lshr i32 %tmp14, 31 ; <i32> [#uses=1]
%tmp15 = shr uint %tmp14, ubyte 31 %tmp15.upgrd.3 = trunc i32 %tmp15 to i8 ; <i8> [#uses=1]
%tmp15 = cast uint %tmp15 to ubyte %tmp16 = icmp ne i8 %tmp15.upgrd.3, 0 ; <i1> [#uses=1]
%tmp16 = setne ubyte %tmp15, 0 br i1 %tmp.upgrd.2, label %cond_false25, label %cond_true
br bool %tmp, label %cond_false25, label %cond_true cond_true: ; preds = %0
br i1 %tmp16, label %cond_true17, label %cond_false
cond_true: cond_true17: ; preds = %cond_true
br bool %tmp16, label %cond_true17, label %cond_false
cond_true17:
ret void ret void
cond_false: ; preds = %cond_true
cond_false:
ret void ret void
cond_false25: ; preds = %0
cond_false25:
ret void ret void
} }

View File

@ -1,62 +1,59 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 | grep {subl \$4, %esp} ; RUN: llvm-as < %s | llc -march=x86 | grep {subl \$4, %esp}
target triple = "i686-pc-linux-gnu" target triple = "i686-pc-linux-gnu"
@str = internal constant [9 x i8] c"%f+%f*i\0A\00" ; <[9 x i8]*> [#uses=1]
%str = internal constant [9 x sbyte] c"%f+%f*i\0A\00" ; <[9 x sbyte]*> [#uses=1] define i32 @main() {
implementation ; Functions:
int %main() {
entry: entry:
%retval = alloca int, align 4 ; <int*> [#uses=1] %retval = alloca i32, align 4 ; <i32*> [#uses=1]
%tmp = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=4] %tmp = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=4]
%tmp1 = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=4] %tmp1 = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=4]
%tmp2 = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=3] %tmp2 = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=3]
%pi = alloca double, align 8 ; <double*> [#uses=2] %pi = alloca double, align 8 ; <double*> [#uses=2]
%z = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=4] %z = alloca { double, double }, align 16 ; <{ double, double }*> [#uses=4]
"alloca point" = cast int 0 to int ; <int> [#uses=0] %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
store double 0x400921FB54442D18, double* %pi store double 0x400921FB54442D18, double* %pi
%tmp = load double* %pi ; <double> [#uses=1] %tmp.upgrd.1 = load double* %pi ; <double> [#uses=1]
%real = getelementptr { double, double }* %tmp1, uint 0, uint 0 ; <double*> [#uses=1] %real = getelementptr { double, double }* %tmp1, i64 0, i32 0 ; <double*> [#uses=1]
store double 0.000000e+00, double* %real store double 0.000000e+00, double* %real
%real3 = getelementptr { double, double }* %tmp1, uint 0, uint 1 ; <double*> [#uses=1] %real3 = getelementptr { double, double }* %tmp1, i64 0, i32 1 ; <double*> [#uses=1]
store double %tmp, double* %real3 store double %tmp.upgrd.1, double* %real3
%tmp = getelementptr { double, double }* %tmp, uint 0, uint 0 ; <double*> [#uses=1] %tmp.upgrd.2 = getelementptr { double, double }* %tmp, i64 0, i32 0 ; <double*> [#uses=1]
%tmp4 = getelementptr { double, double }* %tmp1, uint 0, uint 0 ; <double*> [#uses=1] %tmp4 = getelementptr { double, double }* %tmp1, i64 0, i32 0 ; <double*> [#uses=1]
%tmp5 = load double* %tmp4 ; <double> [#uses=1] %tmp5 = load double* %tmp4 ; <double> [#uses=1]
store double %tmp5, double* %tmp store double %tmp5, double* %tmp.upgrd.2
%tmp6 = getelementptr { double, double }* %tmp, uint 0, uint 1 ; <double*> [#uses=1] %tmp6 = getelementptr { double, double }* %tmp, i64 0, i32 1 ; <double*> [#uses=1]
%tmp7 = getelementptr { double, double }* %tmp1, uint 0, uint 1 ; <double*> [#uses=1] %tmp7 = getelementptr { double, double }* %tmp1, i64 0, i32 1 ; <double*> [#uses=1]
%tmp8 = load double* %tmp7 ; <double> [#uses=1] %tmp8 = load double* %tmp7 ; <double> [#uses=1]
store double %tmp8, double* %tmp6 store double %tmp8, double* %tmp6
%tmp = cast { double, double }* %tmp to { long, long }* ; <{ long, long }*> [#uses=1] %tmp.upgrd.3 = bitcast { double, double }* %tmp to { i64, i64 }* ; <{ i64, i64 }*> [#uses=1]
%tmp = getelementptr { long, long }* %tmp, uint 0, uint 0 ; <long*> [#uses=1] %tmp.upgrd.4 = getelementptr { i64, i64 }* %tmp.upgrd.3, i64 0, i32 0 ; <i64*> [#uses=1]
%tmp = load long* %tmp ; <long> [#uses=1] %tmp.upgrd.5 = load i64* %tmp.upgrd.4 ; <i64> [#uses=1]
%tmp9 = cast { double, double }* %tmp to { long, long }* ; <{ long, long }*> [#uses=1] %tmp9 = bitcast { double, double }* %tmp to { i64, i64 }* ; <{ i64, i64 }*> [#uses=1]
%tmp10 = getelementptr { long, long }* %tmp9, uint 0, uint 1 ; <long*> [#uses=1] %tmp10 = getelementptr { i64, i64 }* %tmp9, i64 0, i32 1 ; <i64*> [#uses=1]
%tmp11 = load long* %tmp10 ; <long> [#uses=1] %tmp11 = load i64* %tmp10 ; <i64> [#uses=1]
call csretcc void %cexp( { double, double }* %tmp2, long %tmp, long %tmp11 ) call void @cexp( { double, double }* sret %tmp2, i64 %tmp.upgrd.5, i64 %tmp11 )
%tmp12 = getelementptr { double, double }* %z, uint 0, uint 0 ; <double*> [#uses=1] %tmp12 = getelementptr { double, double }* %z, i64 0, i32 0 ; <double*> [#uses=1]
%tmp13 = getelementptr { double, double }* %tmp2, uint 0, uint 0 ; <double*> [#uses=1] %tmp13 = getelementptr { double, double }* %tmp2, i64 0, i32 0 ; <double*> [#uses=1]
%tmp14 = load double* %tmp13 ; <double> [#uses=1] %tmp14 = load double* %tmp13 ; <double> [#uses=1]
store double %tmp14, double* %tmp12 store double %tmp14, double* %tmp12
%tmp15 = getelementptr { double, double }* %z, uint 0, uint 1 ; <double*> [#uses=1] %tmp15 = getelementptr { double, double }* %z, i64 0, i32 1 ; <double*> [#uses=1]
%tmp16 = getelementptr { double, double }* %tmp2, uint 0, uint 1 ; <double*> [#uses=1] %tmp16 = getelementptr { double, double }* %tmp2, i64 0, i32 1 ; <double*> [#uses=1]
%tmp17 = load double* %tmp16 ; <double> [#uses=1] %tmp17 = load double* %tmp16 ; <double> [#uses=1]
store double %tmp17, double* %tmp15 store double %tmp17, double* %tmp15
%tmp18 = getelementptr { double, double }* %z, uint 0, uint 1 ; <double*> [#uses=1] %tmp18 = getelementptr { double, double }* %z, i64 0, i32 1 ; <double*> [#uses=1]
%tmp19 = load double* %tmp18 ; <double> [#uses=1] %tmp19 = load double* %tmp18 ; <double> [#uses=1]
%tmp20 = getelementptr { double, double }* %z, uint 0, uint 0 ; <double*> [#uses=1] %tmp20 = getelementptr { double, double }* %z, i64 0, i32 0 ; <double*> [#uses=1]
%tmp21 = load double* %tmp20 ; <double> [#uses=1] %tmp21 = load double* %tmp20 ; <double> [#uses=1]
%tmp = getelementptr [9 x sbyte]* %str, int 0, uint 0 ; <sbyte*> [#uses=1] %tmp.upgrd.6 = getelementptr [9 x i8]* @str, i32 0, i64 0 ; <i8*> [#uses=1]
%tmp = call int (sbyte*, ...)* %printf( sbyte* %tmp, double %tmp21, double %tmp19 ) ; <int> [#uses=0] %tmp.upgrd.7 = call i32 (i8*, ...)* @printf( i8* %tmp.upgrd.6, double %tmp21, double %tmp19 ) ; <i32> [#uses=0]
br label %return br label %return
return: ; preds = %entry
return: ; preds = %entry %retval.upgrd.8 = load i32* %retval ; <i32> [#uses=1]
%retval = load int* %retval ; <int> [#uses=1] ret i32 %retval.upgrd.8
ret int %retval
} }
declare csretcc void %cexp({ double, double }*, long, long) declare void @cexp({ double, double }* sret , i64, i64)
declare i32 @printf(i8*, ...)
declare int %printf(sbyte*, ...)

View File

@ -1,43 +1,34 @@
; RUN: llvm-upgrade < %s | llvm-as | llc -march=x86 -x86-asm-syntax=intel | \ ; RUN: llvm-as < %s | llc -march=x86 -x86-asm-syntax=intel | \
; RUN: grep {and DWORD PTR} | count 2 ; RUN: grep {and DWORD PTR} | count 2
target endian = little target datalayout = "e-p:32:32"
target pointersize = 32 %struct.Macroblock = type { i32, i32, i32, i32, i32, [8 x i32], %struct.Macroblock*, %struct.Macroblock*, i32, [2 x [4 x [4 x [2 x i32]]]], [16 x i8], [16 x i8], i32, i64, [4 x i32], [4 x i32], i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, double, i32, i32, i32, i32, i32, i32, i32, i32, i32 }
%struct.Macroblock = type { int, int, int, int, int, [8 x int], %struct.Macroblock*, %struct.Macroblock*, int, [2 x [4 x [4 x [2 x int]]]], [16 x sbyte], [16 x sbyte], int, long, [4 x int], [4 x int], long, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, short, double, int, int, int, int, int, int, int, int, int } define internal fastcc i32 @dct_chroma(i32 %uv, i32 %cr_cbp) {
implementation ; Functions:
internal fastcc int %dct_chroma(int %uv, int %cr_cbp) {
entry: entry:
br bool true, label %cond_true2732.preheader, label %cond_true129 br i1 true, label %cond_true2732.preheader, label %cond_true129
cond_true129: ; preds = %entry
cond_true129: ; preds = %entry ret i32 0
ret int 0 cond_true2732.preheader: ; preds = %entry
%tmp2666 = getelementptr %struct.Macroblock* null, i32 0, i32 13 ; <i64*> [#uses=2]
cond_true2732.preheader: ; preds = %bb2611 %tmp2674 = trunc i32 0 to i8 ; <i8> [#uses=1]
%tmp2666 = getelementptr %struct.Macroblock* null, int 0, uint 13 ; <long*> [#uses=2] br i1 true, label %cond_true2732.preheader.split.us, label %cond_true2732.preheader.split
%tmp2674 = cast int 0 to ubyte ; <ubyte> [#uses=1] cond_true2732.preheader.split.us: ; preds = %cond_true2732.preheader
br bool true, label %cond_true2732.preheader.split.us, label %cond_true2732.preheader.split br i1 true, label %cond_true2732.outer.us.us, label %cond_true2732.outer.us
cond_true2732.outer.us.us: ; preds = %cond_true2732.preheader.split.us
cond_true2732.preheader.split.us: ; preds = %cond_true2732.preheader %tmp2667.us.us = load i64* %tmp2666 ; <i64> [#uses=1]
br bool true, label %cond_true2732.outer.us.us, label %cond_true2732.outer.us %tmp2670.us.us = load i64* null ; <i64> [#uses=1]
%shift.upgrd.1 = zext i8 %tmp2674 to i64 ; <i64> [#uses=1]
cond_true2732.outer.us.us: ; preds = %cond_true2732.preheader.split.us %tmp2675.us.us = shl i64 %tmp2670.us.us, %shift.upgrd.1 ; <i64> [#uses=1]
%tmp2667.us.us = load long* %tmp2666 ; <long> [#uses=1] %tmp2675not.us.us = xor i64 %tmp2675.us.us, -1 ; <i64> [#uses=1]
%tmp2670.us.us = load long* null ; <long> [#uses=1] %tmp2676.us.us = and i64 %tmp2667.us.us, %tmp2675not.us.us ; <i64> [#uses=1]
%tmp2675.us.us = shl long %tmp2670.us.us, ubyte %tmp2674 ; <long> [#uses=1] store i64 %tmp2676.us.us, i64* %tmp2666
%tmp2675not.us.us = xor long %tmp2675.us.us, -1 ; <long> [#uses=1] ret i32 0
%tmp2676.us.us = and long %tmp2667.us.us, %tmp2675not.us.us ; <long> [#uses=1] cond_true2732.outer.us: ; preds = %cond_true2732.preheader.split.us
store long %tmp2676.us.us, long* %tmp2666 ret i32 0
ret int 0 cond_true2732.preheader.split: ; preds = %cond_true2732.preheader
ret i32 0
cond_true2732.outer.us: ; preds = %cond_true2732.preheader.split.us cond_next2752: ; No predecessors!
ret int 0 ret i32 0
cond_true2732.preheader.split: ; preds = %cond_true2732.preheader
ret int 0
cond_next2752: ; preds = %bb2611
ret int 0
} }

View File

@ -1,58 +1,77 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \ ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
; RUN: grep call | notcast ; RUN: grep call | notcast
; END. ; END.
implementation
; Simple case, argument translatable without changing the value ; Simple case, argument translatable without changing the value
declare void %test1a(sbyte *%A) declare void @test1a(i8*)
void %test1(int *%A) {
call void(int*)* cast (void(sbyte*)* %test1a to void(int*)*)(int* %A) define void @test1(i32* %A) {
call void bitcast (void (i8*)* @test1a to void (i32*)*)( i32* %A )
ret void ret void
} }
; More complex case, translate argument because of resolution. This is safe ; More complex case, translate argument because of resolution. This is safe
; because we have the body of the function ; because we have the body of the function
void %test2a(sbyte %A) { ret void } define void @test2a(i8 %A) {
int %test2(int %A) { ret void
call void(int)* cast (void(sbyte)* %test2a to void(int)*)(int %A)
ret int %A
} }
define i32 @test2(i32 %A) {
call void bitcast (void (i8)* @test2a to void (i32)*)( i32 %A )
ret i32 %A
}
; Resolving this should insert a cast from sbyte to int, following the C ; Resolving this should insert a cast from sbyte to int, following the C
; promotion rules. ; promotion rules.
declare void %test3a(sbyte %A, ...) declare void @test3a(i8, ...)
void %test3(sbyte %A, sbyte %B) {
call void(sbyte, sbyte)* cast (void(sbyte,...)* %test3a to void(sbyte,sbyte)*)(sbyte %A, sbyte %B) define void @test3(i8 %A, i8 %B) {
call void bitcast (void (i8, ...)* @test3a to void (i8, i8)*)( i8 %A, i8 %B
)
ret void ret void
} }
; test conversion of return value... ; test conversion of return value...
sbyte %test4a() { ret sbyte 0 } define i8 @test4a() {
int %test4() { ret i8 0
%X = call int()* cast (sbyte()* %test4a to int()*)()
ret int %X
} }
define i32 @test4() {
%X = call i32 bitcast (i8 ()* @test4a to i32 ()*)( ) ; <i32> [#uses=1]
ret i32 %X
}
; test conversion of return value... no value conversion occurs so we can do ; test conversion of return value... no value conversion occurs so we can do
; this with just a prototype... ; this with just a prototype...
declare uint %test5a() declare i32 @test5a()
int %test5() {
%X = call int()* cast (uint()* %test5a to int()*)() define i32 @test5() {
ret int %X %X = call i32 @test5a( ) ; <i32> [#uses=1]
ret i32 %X
} }
; test addition of new arguments... ; test addition of new arguments...
declare int %test6a(int %X) declare i32 @test6a(i32)
int %test6() {
%X = call int()* cast (int(int)* %test6a to int()*)() define i32 @test6() {
ret int %X %X = call i32 bitcast (i32 (i32)* @test6a to i32 ()*)( ) ; <i32> [#uses=1]
ret i32 %X
} }
; test removal of arguments, only can happen with a function body ; test removal of arguments, only can happen with a function body
void %test7a() { ret void } define void @test7a() {
void %test7() {
call void(int)* cast (void()* %test7a to void(int)*)(int 5)
ret void ret void
} }
define void @test7() {
call void bitcast (void ()* @test7a to void (i32)*)( i32 5 )
ret void
}

View File

@ -1,98 +1,101 @@
; Tests to make sure elimination of casts is working correctly ; Tests to make sure elimination of casts is working correctly
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \ ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
; RUN: grep %c | notcast ; RUN: grep %c | notcast
; END. ; END.
%inbuf = external global [32832 x ubyte] @inbuf = external global [32832 x i8] ; <[32832 x i8]*> [#uses=1]
implementation define i32 @test1(i32 %A) {
%c1 = bitcast i32 %A to i32 ; <i32> [#uses=1]
int %test1(int %A) { %c2 = bitcast i32 %c1 to i32 ; <i32> [#uses=1]
%c1 = cast int %A to uint ret i32 %c2
%c2 = cast uint %c1 to int
ret int %c2
} }
ulong %test2(ubyte %A) { define i64 @test2(i8 %A) {
%c1 = cast ubyte %A to ushort %c1 = zext i8 %A to i16 ; <i16> [#uses=1]
%c2 = cast ushort %c1 to uint %c2 = zext i16 %c1 to i32 ; <i32> [#uses=1]
%Ret = cast uint %c2 to ulong %Ret = zext i32 %c2 to i64 ; <i64> [#uses=1]
ret ulong %Ret ret i64 %Ret
} }
ulong %test3(ulong %A) { ; This function should just use bitwise AND ; This function should just use bitwise AND
%c1 = cast ulong %A to ubyte define i64 @test3(i64 %A) {
%c2 = cast ubyte %c1 to ulong %c1 = trunc i64 %A to i8 ; <i8> [#uses=1]
ret ulong %c2 %c2 = zext i8 %c1 to i64 ; <i64> [#uses=1]
ret i64 %c2
} }
uint %test4(int %A, int %B) { define i32 @test4(i32 %A, i32 %B) {
%COND = setlt int %A, %B %COND = icmp slt i32 %A, %B ; <i1> [#uses=1]
%c = cast bool %COND to ubyte ; Booleans are unsigned integrals ; Booleans are unsigned integrals
%result = cast ubyte %c to uint ; for the cast elim purpose %c = zext i1 %COND to i8 ; <i8> [#uses=1]
ret uint %result ; for the cast elim purpose
%result = zext i8 %c to i32 ; <i32> [#uses=1]
ret i32 %result
} }
int %test5(bool %B) { define i32 @test5(i1 %B) {
%c = cast bool %B to ubyte ; This cast should get folded into ; This cast should get folded into
%result = cast ubyte %c to int ; this cast %c = zext i1 %B to i8 ; <i8> [#uses=1]
ret int %result ; this cast
%result = zext i8 %c to i32 ; <i32> [#uses=1]
ret i32 %result
} }
int %test6(ulong %A) { define i32 @test6(i64 %A) {
%c1 = cast ulong %A to uint %c1 = trunc i64 %A to i32 ; <i32> [#uses=1]
%res = cast uint %c1 to int %res = bitcast i32 %c1 to i32 ; <i32> [#uses=1]
ret int %res ret i32 %res
} }
long %test7(bool %A) { define i64 @test7(i1 %A) {
%c1 = cast bool %A to int %c1 = zext i1 %A to i32 ; <i32> [#uses=1]
%res = cast int %c1 to long %res = sext i32 %c1 to i64 ; <i64> [#uses=1]
ret long %res ret i64 %res
} }
long %test8(sbyte %A) { define i64 @test8(i8 %A) {
%c1 = cast sbyte %A to ulong %c1 = sext i8 %A to i64 ; <i64> [#uses=1]
%res = cast ulong %c1 to long %res = bitcast i64 %c1 to i64 ; <i64> [#uses=1]
ret long %res ret i64 %res
} }
short %test9(short %A) { define i16 @test9(i16 %A) {
%c1 = cast short %A to int %c1 = sext i16 %A to i32 ; <i32> [#uses=1]
%c2 = cast int %c1 to short %c2 = trunc i32 %c1 to i16 ; <i16> [#uses=1]
ret short %c2 ret i16 %c2
} }
short %test10(short %A) { define i16 @test10(i16 %A) {
%c1 = cast short %A to uint %c1 = sext i16 %A to i32 ; <i32> [#uses=1]
%c2 = cast uint %c1 to short %c2 = trunc i32 %c1 to i16 ; <i16> [#uses=1]
ret short %c2 ret i16 %c2
} }
declare void %varargs(int, ...) declare void @varargs(i32, ...)
void %test11(int* %P) { define void @test11(i32* %P) {
%c = cast int* %P to short* %c = bitcast i32* %P to i16* ; <i16*> [#uses=1]
call void(int, ...)* %varargs(int 5, short* %c) call void (i32, ...)* @varargs( i32 5, i16* %c )
ret void ret void
} }
int* %test12() { define i32* @test12() {
%p = malloc [4 x sbyte] %p = malloc [4 x i8] ; <[4 x i8]*> [#uses=1]
%c = cast [4 x sbyte]* %p to int* %c = bitcast [4 x i8]* %p to i32* ; <i32*> [#uses=1]
ret int* %c ret i32* %c
}
define i8* @test13(i64 %A) {
%c = getelementptr [0 x i8]* bitcast ([32832 x i8]* @inbuf to [0 x i8]*), i64 0, i64 %A ; <i8*> [#uses=1]
ret i8* %c
} }
ubyte *%test13(long %A) { define i1 @test14(i8 %A) {
%c = getelementptr [0 x ubyte]* cast ([32832 x ubyte]* %inbuf to [0 x ubyte]*), long 0, long %A %c = bitcast i8 %A to i8 ; <i8> [#uses=1]
ret ubyte* %c %X = icmp ult i8 %c, -128 ; <i1> [#uses=1]
ret i1 %X
} }
bool %test14(sbyte %A) {
%c = cast sbyte %A to ubyte
%X = setlt ubyte %c, 128 ; setge %A, 0
ret bool %X
}
; This just won't occur when there's no difference between ubyte and sbyte ; This just won't occur when there's no difference between ubyte and sbyte
;bool %test15(ubyte %A) { ;bool %test15(ubyte %A) {
@ -101,130 +104,137 @@ bool %test14(sbyte %A) {
; ret bool %X ; ret bool %X
;} ;}
bool %test16(int* %P) { define i1 @test16(i32* %P) {
%c = cast int* %P to bool ;; setne P, null %c = icmp ne i32* %P, null ; <i1> [#uses=1]
ret bool %c ret i1 %c
} }
short %test17(bool %tmp3) { define i16 @test17(i1 %tmp3) {
%c = cast bool %tmp3 to int %c = zext i1 %tmp3 to i32 ; <i32> [#uses=1]
%t86 = cast int %c to short %t86 = trunc i32 %c to i16 ; <i16> [#uses=1]
ret short %t86 ret i16 %t86
} }
short %test18(sbyte %tmp3) { define i16 @test18(i8 %tmp3) {
%c = cast sbyte %tmp3 to int %c = sext i8 %tmp3 to i32 ; <i32> [#uses=1]
%t86 = cast int %c to short %t86 = trunc i32 %c to i16 ; <i16> [#uses=1]
ret short %t86 ret i16 %t86
} }
bool %test19(int %X) { define i1 @test19(i32 %X) {
%c = cast int %X to long %c = sext i32 %X to i64 ; <i64> [#uses=1]
%Z = setlt long %c, 12345 %Z = icmp slt i64 %c, 12345 ; <i1> [#uses=1]
ret bool %Z ret i1 %Z
} }
bool %test20(bool %B) { define i1 @test20(i1 %B) {
%c = cast bool %B to int %c = zext i1 %B to i32 ; <i32> [#uses=1]
%D = setlt int %c, -1 %D = icmp slt i32 %c, -1 ; <i1> [#uses=1]
ret bool %D ;; false ;; false
ret i1 %D
} }
uint %test21(uint %X) { define i32 @test21(i32 %X) {
%c1 = cast uint %X to sbyte %c1 = trunc i32 %X to i8 ; <i8> [#uses=1]
%c2 = cast sbyte %c1 to uint ;; sext -> zext -> and -> nop ;; sext -> zext -> and -> nop
%RV = and uint %c2, 255 %c2 = sext i8 %c1 to i32 ; <i32> [#uses=1]
ret uint %RV %RV = and i32 %c2, 255 ; <i32> [#uses=1]
ret i32 %RV
} }
uint %test22(uint %X) { define i32 @test22(i32 %X) {
%c1 = cast uint %X to sbyte %c1 = trunc i32 %X to i8 ; <i8> [#uses=1]
%c2 = cast sbyte %c1 to uint ;; sext -> zext -> and -> nop ;; sext -> zext -> and -> nop
%RV = shl uint %c2, ubyte 24 %c2 = sext i8 %c1 to i32 ; <i32> [#uses=1]
ret uint %RV %RV = shl i32 %c2, 24 ; <i32> [#uses=1]
ret i32 %RV
} }
int %test23(int %X) { define i32 @test23(i32 %X) {
%c1 = cast int %X to ushort ;; Turn into an AND even though X ;; Turn into an AND even though X
%c2 = cast ushort %c1 to int ;; and Z are signed. %c1 = trunc i32 %X to i16 ; <i16> [#uses=1]
ret int %c2 ;; and Z are signed.
%c2 = zext i16 %c1 to i32 ; <i32> [#uses=1]
ret i32 %c2
} }
bool %test24(bool %C) { define i1 @test24(i1 %C) {
%X = select bool %C, uint 14, uint 1234 %X = select i1 %C, i32 14, i32 1234 ; <i32> [#uses=1]
%c = cast uint %X to bool ;; Fold cast into select ;; Fold cast into select
ret bool %c %c = icmp ne i32 %X, 0 ; <i1> [#uses=1]
ret i1 %c
} }
void %test25(int** %P) { define void @test25(i32** %P) {
%c = cast int** %P to float** %c = bitcast i32** %P to float** ; <float**> [#uses=1]
store float* null, float** %c ;; Fold cast into null ;; Fold cast into null
store float* null, float** %c
ret void ret void
} }
int %test26(float %F) { define i32 @test26(float %F) {
%c = cast float %F to double ;; no need to cast from float->double. ;; no need to cast from float->double.
%D = cast double %c to int %c = fpext float %F to double ; <double> [#uses=1]
ret int %D %D = fptosi double %c to i32 ; <i32> [#uses=1]
ret i32 %D
} }
[4 x float]* %test27([9 x [4 x float]]* %A) { define [4 x float]* @test27([9 x [4 x float]]* %A) {
%c = cast [9 x [4 x float]]* %A to [4 x float]* %c = bitcast [9 x [4 x float]]* %A to [4 x float]* ; <[4 x float]*> [#uses=1]
ret [4 x float]* %c ret [4 x float]* %c
} }
float* %test28([4 x float]* %A) { define float* @test28([4 x float]* %A) {
%c = cast [4 x float]* %A to float* %c = bitcast [4 x float]* %A to float* ; <float*> [#uses=1]
ret float* %c ret float* %c
} }
uint %test29(uint %c1, uint %c2) { define i32 @test29(i32 %c1, i32 %c2) {
%tmp1 = cast uint %c1 to ubyte %tmp1 = trunc i32 %c1 to i8 ; <i8> [#uses=1]
%tmp4.mask = cast uint %c2 to ubyte %tmp4.mask = trunc i32 %c2 to i8 ; <i8> [#uses=1]
%tmp = or ubyte %tmp4.mask, %tmp1 %tmp = or i8 %tmp4.mask, %tmp1 ; <i8> [#uses=1]
%tmp10 = cast ubyte %tmp to uint %tmp10 = zext i8 %tmp to i32 ; <i32> [#uses=1]
ret uint %tmp10 ret i32 %tmp10
} }
uint %test30(uint %c1) { define i32 @test30(i32 %c1) {
%c2 = cast uint %c1 to ubyte %c2 = trunc i32 %c1 to i8 ; <i8> [#uses=1]
%c3 = xor ubyte %c2, 1 %c3 = xor i8 %c2, 1 ; <i8> [#uses=1]
%c4 = cast ubyte %c3 to uint %c4 = zext i8 %c3 to i32 ; <i32> [#uses=1]
ret uint %c4 ret i32 %c4
} }
bool %test31(ulong %A) { define i1 @test31(i64 %A) {
%B = cast ulong %A to int %B = trunc i64 %A to i32 ; <i32> [#uses=1]
%C = and int %B, 42 %C = and i32 %B, 42 ; <i32> [#uses=1]
%D = seteq int %C, 10 %D = icmp eq i32 %C, 10 ; <i1> [#uses=1]
ret bool %D ret i1 %D
} }
define void @test32(double** %tmp) {
void %test32(double** %tmp) { %tmp8 = malloc [16 x i8] ; <[16 x i8]*> [#uses=1]
%tmp8 = malloc [16 x sbyte] %tmp8.upgrd.1 = bitcast [16 x i8]* %tmp8 to double* ; <double*> [#uses=1]
%tmp8 = cast [16 x sbyte]* %tmp8 to double* store double* %tmp8.upgrd.1, double** %tmp
store double* %tmp8, double** %tmp
ret void ret void
} }
uint %test33(uint %c1) { define i32 @test33(i32 %c1) {
%x = bitcast uint %c1 to float %x = bitcast i32 %c1 to float ; <float> [#uses=1]
%y = bitcast float %x to uint %y = bitcast float %x to i32 ; <i32> [#uses=1]
ret uint %y ret i32 %y
} }
ushort %test34(ushort %a) { define i16 @test34(i16 %a) {
%c1 = zext ushort %a to int %c1 = zext i16 %a to i32 ; <i32> [#uses=1]
%tmp21 = lshr int %c1, ubyte 8 %tmp21 = lshr i32 %c1, 8 ; <i32> [#uses=1]
%c2 = trunc int %tmp21 to ushort %c2 = trunc i32 %tmp21 to i16 ; <i16> [#uses=1]
ret ushort %c2 ret i16 %c2
} }
ushort %test35(ushort %a) { define i16 @test35(i16 %a) {
%c1 = bitcast ushort %a to short %c1 = bitcast i16 %a to i16 ; <i16> [#uses=1]
%tmp2 = lshr short %c1, ubyte 8 %tmp2 = lshr i16 %c1, 8 ; <i16> [#uses=1]
%c2 = bitcast short %tmp2 to ushort %c2 = bitcast i16 %tmp2 to i16 ; <i16> [#uses=1]
ret ushort %c2 ret i16 %c2
} }

View File

@ -1,76 +1,81 @@
; The %A getelementptr instruction should be eliminated here ; The %A getelementptr instruction should be eliminated here
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | \ ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | \
; RUN: grep -v %B | not grep getelementptr ; RUN: grep -v %B | not grep getelementptr
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | grep foo1 ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | grep foo1
; END. ; END.
%Global = constant [10 x sbyte] c"helloworld" @Global = constant [10 x i8] c"helloworld" ; <[10 x i8]*> [#uses=1]
implementation ; Test noop elimination
define i32* @foo1(i32* %I) {
int *%foo1(int* %I) { ; Test noop elimination %A = getelementptr i32* %I, i64 0 ; <i32*> [#uses=1]
%A = getelementptr int* %I, long 0 ret i32* %A
ret int * %A
} }
int* %foo2(int* %I) { ; Test noop elimination ; Test noop elimination
%A = getelementptr int* %I define i32* @foo2(i32* %I) {
ret int* %A %A = getelementptr i32* %I ; <i32*> [#uses=1]
} ret i32* %A
int* %foo3(int * %I) { ; Test that two array indexing geps fold
%A = getelementptr int* %I, long 17
%B = getelementptr int* %A, long 4
ret int* %B
} }
int* %foo4({int} *%I) { ; Test that two getelementptr insts fold ; Test that two array indexing geps fold
%A = getelementptr {int}* %I, long 1 define i32* @foo3(i32* %I) {
%B = getelementptr {int}* %A, long 0, uint 0 %A = getelementptr i32* %I, i64 17 ; <i32*> [#uses=1]
ret int* %B %B = getelementptr i32* %A, i64 4 ; <i32*> [#uses=1]
ret i32* %B
} }
void %foo5(sbyte %B) { ; Test that two getelementptr insts fold
; This should be turned into a constexpr instead of being an instruction define i32* @foo4({ i32 }* %I) {
%A = getelementptr [10 x sbyte]* %Global, long 0, long 4 %A = getelementptr { i32 }* %I, i64 1 ; <{ i32 }*> [#uses=1]
store sbyte %B, sbyte* %A %B = getelementptr { i32 }* %A, i64 0, i32 0 ; <i32*> [#uses=1]
ret void ret i32* %B
} }
int* %foo6() { define void @foo5(i8 %B) {
%M = malloc [4 x int] ; This should be turned into a constexpr instead of being an instruction
%A = getelementptr [4 x int]* %M, long 0, long 0 %A = getelementptr [10 x i8]* @Global, i64 0, i64 4 ; <i8*> [#uses=1]
%B = getelementptr int* %A, long 2 store i8 %B, i8* %A
ret int* %B ret void
} }
int* %foo7(int* %I, long %C, long %D) { define i32* @foo6() {
%A = getelementptr int* %I, long %C %M = malloc [4 x i32] ; <[4 x i32]*> [#uses=1]
%B = getelementptr int* %A, long %D %A = getelementptr [4 x i32]* %M, i64 0, i64 0 ; <i32*> [#uses=1]
ret int* %B %B = getelementptr i32* %A, i64 2 ; <i32*> [#uses=1]
ret i32* %B
} }
sbyte* %foo8([10 x int]* %X) { define i32* @foo7(i32* %I, i64 %C, i64 %D) {
%A = getelementptr [10 x int]* %X, long 0, long 0 ;; Fold into the cast. %A = getelementptr i32* %I, i64 %C ; <i32*> [#uses=1]
%B = cast int* %A to sbyte* %B = getelementptr i32* %A, i64 %D ; <i32*> [#uses=1]
ret sbyte * %B ret i32* %B
} }
int %test9() { define i8* @foo8([10 x i32]* %X) {
%A = getelementptr {int, double}* null, int 0, uint 1 ;; Fold into the cast.
%B = cast double* %A to int %A = getelementptr [10 x i32]* %X, i64 0, i64 0 ; <i32*> [#uses=1]
ret int %B %B = bitcast i32* %A to i8* ; <i8*> [#uses=1]
ret i8* %B
} }
bool %test10({int, int} * %x, {int, int} * %y) { define i32 @test9() {
%tmp.1 = getelementptr {int,int}* %x, int 0, uint 1 %A = getelementptr { i32, double }* null, i32 0, i32 1 ; <double*> [#uses=1]
%tmp.3 = getelementptr {int,int}* %y, int 0, uint 1 %B = ptrtoint double* %A to i32 ; <i32> [#uses=1]
%tmp.4 = seteq int* %tmp.1, %tmp.3 ;; seteq x, y ret i32 %B
ret bool %tmp.4
} }
bool %test11({int,int} *%X) { define i1 @test10({ i32, i32 }* %x, { i32, i32 }* %y) {
%P = getelementptr {int,int}* %X, int 0, uint 0 %tmp.1 = getelementptr { i32, i32 }* %x, i32 0, i32 1 ; <i32*> [#uses=1]
%Q = seteq int* %P, null %tmp.3 = getelementptr { i32, i32 }* %y, i32 0, i32 1 ; <i32*> [#uses=1]
ret bool %Q ;; seteq x, y
%tmp.4 = icmp eq i32* %tmp.1, %tmp.3 ; <i1> [#uses=1]
ret i1 %tmp.4
}
define i1 @test11({ i32, i32 }* %X) {
%P = getelementptr { i32, i32 }* %X, i32 0, i32 0 ; <i32*> [#uses=1]
%Q = icmp eq i32* %P, null ; <i1> [#uses=1]
ret i1 %Q
} }

View File

@ -1,73 +1,70 @@
; This test makes sure that these instructions are properly eliminated. ; This test makes sure that these instructions are properly eliminated.
; ;
; RUN: llvm-upgrade < %s | llvm-as | opt -instcombine | llvm-dis | not grep load ; RUN: llvm-as < %s | opt -instcombine | llvm-dis | not grep load
%X = constant int 42 @X = constant i32 42 ; <i32*> [#uses=2]
%X2 = constant int 47 @X2 = constant i32 47 ; <i32*> [#uses=1]
%Y = constant [2 x { int, float }] [ { int, float } { int 12, float 1.0 }, @Y = constant [2 x { i32, float }] [ { i32, float } { i32 12, float 1.000000e+00 }, { i32, float } { i32 37, float 0x3FF3B2FEC0000000 } ] ; <[2 x { i32, float }]*> [#uses=2]
{ int, float } { int 37, float 0x3FF3B2FEC0000000 } ] @Z = constant [2 x { i32, float }] zeroinitializer ; <[2 x { i32, float }]*> [#uses=1]
%Z = constant [2 x { int, float }] zeroinitializer
int %test1() { define i32 @test1() {
%B = load int* %X %B = load i32* @X ; <i32> [#uses=1]
ret int %B ret i32 %B
} }
float %test2() { define float @test2() {
%A = getelementptr [2 x { int, float}]* %Y, long 0, long 1, uint 1 %A = getelementptr [2 x { i32, float }]* @Y, i64 0, i64 1, i32 1 ; <float*> [#uses=1]
%B = load float* %A %B = load float* %A ; <float> [#uses=1]
ret float %B ret float %B
} }
define i32 @test3() {
int %test3() { %A = getelementptr [2 x { i32, float }]* @Y, i64 0, i64 0, i32 0 ; <i32*> [#uses=1]
%A = getelementptr [2 x { int, float}]* %Y, long 0, long 0, uint 0 %B = load i32* %A ; <i32> [#uses=1]
%B = load int* %A ret i32 %B
ret int %B
} }
int %test4() { define i32 @test4() {
%A = getelementptr [2 x { int, float}]* %Z, long 0, long 1, uint 0 %A = getelementptr [2 x { i32, float }]* @Z, i64 0, i64 1, i32 0 ; <i32*> [#uses=1]
%B = load int* %A %B = load i32* %A ; <i32> [#uses=1]
ret int %B ret i32 %B
} }
; load (select (Cond, &V1, &V2)) --> select(Cond, load &V1, load &V2) define i32 @test5(i1 %C) {
int %test5(bool %C) { %Y = select i1 %C, i32* @X, i32* @X2 ; <i32*> [#uses=1]
%Y = select bool %C, int* %X, int* %X2 %Z = load i32* %Y ; <i32> [#uses=1]
%Z = load int* %Y ret i32 %Z
ret int %Z
} }
int %test7(int %X) { define i32 @test7(i32 %X) {
%V = getelementptr int* null, int %X %V = getelementptr i32* null, i32 %X ; <i32*> [#uses=1]
%R = load int* %V %R = load i32* %V ; <i32> [#uses=1]
ret int %R ret i32 %R
} }
int %test8(int* %P) { define i32 @test8(i32* %P) {
store int 1, int* %P store i32 1, i32* %P
%X = load int* %P ;; Trivial store->load forwarding %X = load i32* %P ; <i32> [#uses=1]
ret int %X ret i32 %X
} }
int %test9(int* %P) { define i32 @test9(i32* %P) {
%X = load int* %P ;; Trivial load cse %X = load i32* %P ; <i32> [#uses=1]
%Y = load int* %P %Y = load i32* %P ; <i32> [#uses=1]
%Z = sub int %X, %Y %Z = sub i32 %X, %Y ; <i32> [#uses=1]
ret int %Z ret i32 %Z
} }
int %test10(bool %C, int* %P, int* %Q) { define i32 @test10(i1 %C.upgrd.1, i32* %P, i32* %Q) {
br bool %C, label %T, label %F br i1 %C.upgrd.1, label %T, label %F
T: T: ; preds = %0
store int 1, int* %Q store i32 1, i32* %Q
store int 0, int* %P store i32 0, i32* %P
br label %C br label %C
F: F: ; preds = %0
store int 0, int* %P store i32 0, i32* %P
br label %C br label %C
C: C: ; preds = %F, %T
%V = load int* %P ;; always 0 %V = load i32* %P ; <i32> [#uses=1]
ret int %V ret i32 %V
} }

View File

@ -1,28 +1,23 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -lcssa | llvm-dis | \ ; RUN: llvm-as < %s | opt -lcssa | llvm-dis | \
; RUN: grep {%SJE.0.0.lcssa = phi .struct.SetJmpMapEntry} ; RUN: grep {%SJE.0.0.lcssa = phi .struct.SetJmpMapEntry}
; RUN: llvm-upgrade < %s | llvm-as | opt -lcssa | llvm-dis | \ ; RUN: llvm-as < %s | opt -lcssa | llvm-dis | \
; RUN: grep {%SJE.0.0.lcssa1 = phi .struct.SetJmpMapEntry} ; RUN: grep {%SJE.0.0.lcssa1 = phi .struct.SetJmpMapEntry}
%struct.SetJmpMapEntry = type { sbyte*, uint, %struct.SetJmpMapEntry* } %struct.SetJmpMapEntry = type { i8*, i32, %struct.SetJmpMapEntry* }
implementation ; Functions: define void @__llvm_sjljeh_try_catching_longjmp_exception() {
void %__llvm_sjljeh_try_catching_longjmp_exception() {
entry: entry:
br bool false, label %UnifiedReturnBlock, label %no_exit br i1 false, label %UnifiedReturnBlock, label %no_exit
no_exit: ; preds = %endif, %entry
no_exit: ; preds = %endif, %entry %SJE.0.0 = phi %struct.SetJmpMapEntry* [ %tmp.24, %endif ], [ null, %entry ] ; <%struct.SetJmpMapEntry*> [#uses=1]
%SJE.0.0 = phi %struct.SetJmpMapEntry* [ %tmp.24, %endif ], [ null, %entry ] ; <%struct.SetJmpMapEntry*> [#uses=1] br i1 false, label %then, label %endif
br bool false, label %then, label %endif then: ; preds = %no_exit
%tmp.20 = getelementptr %struct.SetJmpMapEntry* %SJE.0.0, i32 0, i32 1 ; <i32*> [#uses=0]
then: ; preds = %no_exit ret void
%tmp.20 = getelementptr %struct.SetJmpMapEntry* %SJE.0.0, int 0, uint 1 ; <uint*> [#uses=0] endif: ; preds = %no_exit
ret void %tmp.24 = load %struct.SetJmpMapEntry** null ; <%struct.SetJmpMapEntry*> [#uses=1]
br i1 false, label %UnifiedReturnBlock, label %no_exit
endif: ; preds = %no_exit UnifiedReturnBlock: ; preds = %endif, %entry
%tmp.24 = load %struct.SetJmpMapEntry** null ; <%struct.SetJmpMapEntry*> [#uses=1] ret void
br bool false, label %UnifiedReturnBlock, label %no_exit
UnifiedReturnBlock: ; preds = %endif, %entry
ret void
} }

View File

@ -1,30 +1,27 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -lcssa | llvm-dis | \ ; RUN: llvm-as < %s | opt -lcssa | llvm-dis | \
; RUN: grep {%X.1.lcssa} ; RUN: grep {%X.1.lcssa}
; RUN: llvm-upgrade < %s | llvm-as | opt -lcssa | llvm-dis | \ ; RUN: llvm-as < %s | opt -lcssa | llvm-dis | \
; RUN: not grep {%X.1.lcssa1} ; RUN: not grep {%X.1.lcssa1}
declare bool %c1() declare i1 @c1()
declare bool %c2()
int %foo() { declare i1 @c2()
define i32 @foo() {
entry: entry:
br label %loop_begin br label %loop_begin
loop_begin: ; preds = %loop_body.2, %entry
loop_begin: br i1 true, label %loop_body.1, label %loop_exit2
br bool true, label %loop_body.1, label %loop_exit2 loop_body.1: ; preds = %loop_begin
%X.1 = add i32 0, 1 ; <i32> [#uses=1]
loop_body.1: %rel.1 = call i1 @c1( ) ; <i1> [#uses=1]
%X.1 = add int 0, 1 br i1 %rel.1, label %loop_exit, label %loop_body.2
%rel.1 = call bool %c1() loop_body.2: ; preds = %loop_body.1
br bool %rel.1, label %loop_exit, label %loop_body.2 %rel.2 = call i1 @c2( ) ; <i1> [#uses=1]
br i1 %rel.2, label %loop_exit, label %loop_begin
loop_body.2: loop_exit: ; preds = %loop_body.2, %loop_body.1
%rel.2 = call bool %c2() ret i32 %X.1
br bool %rel.2, label %loop_exit, label %loop_begin loop_exit2: ; preds = %loop_begin
ret i32 1
loop_exit:
ret int %X.1
loop_exit2:
ret int 1
} }

View File

@ -1,31 +1,24 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -lcssa ; RUN: llvm-as < %s | opt -lcssa
%struct.SetJmpMapEntry = type { sbyte*, uint, %struct.SetJmpMapEntry* } %struct.SetJmpMapEntry = type { i8*, i32, %struct.SetJmpMapEntry* }
implementation ; Functions: define void @__llvm_sjljeh_try_catching_longjmp_exception() {
void %__llvm_sjljeh_try_catching_longjmp_exception() {
entry: entry:
br label %loopentry br label %loopentry
loopentry: ; preds = %endif, %entry loopentry: ; preds = %endif, %entry
%SJE.0 = phi %struct.SetJmpMapEntry* [ null, %entry ], [ %tmp.25, %endif ] ; <%struct.SetJmpMapEntry*> [#uses=1] %SJE.0 = phi %struct.SetJmpMapEntry* [ null, %entry ], [ %tmp.25, %endif ] ; <%struct.SetJmpMapEntry*> [#uses=1]
br bool false, label %no_exit, label %loopexit br i1 false, label %no_exit, label %loopexit
no_exit: ; preds = %loopentry no_exit: ; preds = %loopentry
br bool false, label %then, label %endif br i1 false, label %then, label %endif
then: ; preds = %no_exit then: ; preds = %no_exit
%tmp.21 = getelementptr %struct.SetJmpMapEntry* %SJE.0, int 0, uint 1 ; <uint*> [#uses=0] %tmp.21 = getelementptr %struct.SetJmpMapEntry* %SJE.0, i32 0, i32 1 ; <i32*> [#uses=0]
br label %return br label %return
endif: ; preds = %no_exit
endif: ; preds = %after_ret.0, %no_exit
%tmp.25 = load %struct.SetJmpMapEntry** null ; <%struct.SetJmpMapEntry*> [#uses=1] %tmp.25 = load %struct.SetJmpMapEntry** null ; <%struct.SetJmpMapEntry*> [#uses=1]
br label %loopentry br label %loopentry
loopexit: ; preds = %loopentry loopexit: ; preds = %loopentry
br label %return br label %return
return: ; preds = %loopexit, %then
return: ; preds = %after_ret.1, %loopexit, %then
ret void ret void
} }

View File

@ -1,210 +1,145 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -lcssa -disable-output ; RUN: llvm-as < %s | opt -lcssa -disable-output
; PR977 ; PR977
; END.
declare i32 @opost_block()
declare int %opost_block() define void @write_chan() {
void %write_chan() {
entry: entry:
br bool false, label %shortcirc_next.0, label %shortcirc_done.0 br i1 false, label %shortcirc_next.0, label %shortcirc_done.0
shortcirc_next.0: ; preds = %entry shortcirc_next.0: ; preds = %entry
br label %shortcirc_done.0 br label %shortcirc_done.0
shortcirc_done.0: ; preds = %shortcirc_next.0, %entry shortcirc_done.0: ; preds = %shortcirc_next.0, %entry
br bool false, label %shortcirc_next.1, label %shortcirc_done.1 br i1 false, label %shortcirc_next.1, label %shortcirc_done.1
shortcirc_next.1: ; preds = %shortcirc_done.0 shortcirc_next.1: ; preds = %shortcirc_done.0
br label %shortcirc_done.1 br label %shortcirc_done.1
shortcirc_done.1: ; preds = %shortcirc_next.1, %shortcirc_done.0 shortcirc_done.1: ; preds = %shortcirc_next.1, %shortcirc_done.0
br bool false, label %then.0, label %endif.0 br i1 false, label %then.0, label %endif.0
then.0: ; preds = %shortcirc_done.1 then.0: ; preds = %shortcirc_done.1
br bool false, label %then.1, label %endif.1 br i1 false, label %then.1, label %endif.1
then.1: ; preds = %then.0 then.1: ; preds = %then.0
br label %return br label %return
after_ret.0: ; No predecessors! after_ret.0: ; No predecessors!
br label %endif.1 br label %endif.1
endif.1: ; preds = %after_ret.0, %then.0 endif.1: ; preds = %after_ret.0, %then.0
br label %endif.0 br label %endif.0
endif.0: ; preds = %endif.1, %shortcirc_done.1 endif.0: ; preds = %endif.1, %shortcirc_done.1
br label %loopentry.0 br label %loopentry.0
loopentry.0: ; preds = %endif.12, %endif.0 loopentry.0: ; preds = %endif.12, %endif.0
br bool false, label %then.2, label %endif.2 br i1 false, label %then.2, label %endif.2
then.2: ; preds = %loopentry.0 then.2: ; preds = %loopentry.0
br label %loopexit.0 br label %loopexit.0
dead_block_after_break.0: ; No predecessors! dead_block_after_break.0: ; No predecessors!
br label %endif.2 br label %endif.2
endif.2: ; preds = %dead_block_after_break.0, %loopentry.0 endif.2: ; preds = %dead_block_after_break.0, %loopentry.0
br bool false, label %shortcirc_done.2, label %shortcirc_next.2 br i1 false, label %shortcirc_done.2, label %shortcirc_next.2
shortcirc_next.2: ; preds = %endif.2 shortcirc_next.2: ; preds = %endif.2
br bool false, label %shortcirc_next.3, label %shortcirc_done.3 br i1 false, label %shortcirc_next.3, label %shortcirc_done.3
shortcirc_next.3: ; preds = %shortcirc_next.2 shortcirc_next.3: ; preds = %shortcirc_next.2
br label %shortcirc_done.3 br label %shortcirc_done.3
shortcirc_done.3: ; preds = %shortcirc_next.3, %shortcirc_next.2 shortcirc_done.3: ; preds = %shortcirc_next.3, %shortcirc_next.2
br label %shortcirc_done.2 br label %shortcirc_done.2
shortcirc_done.2: ; preds = %shortcirc_done.3, %endif.2 shortcirc_done.2: ; preds = %shortcirc_done.3, %endif.2
br bool false, label %then.3, label %endif.3 br i1 false, label %then.3, label %endif.3
then.3: ; preds = %shortcirc_done.2 then.3: ; preds = %shortcirc_done.2
br label %loopexit.0 br label %loopexit.0
dead_block_after_break.1: ; No predecessors! dead_block_after_break.1: ; No predecessors!
br label %endif.3 br label %endif.3
endif.3: ; preds = %dead_block_after_break.1, %shortcirc_done.2 endif.3: ; preds = %dead_block_after_break.1, %shortcirc_done.2
br bool false, label %shortcirc_next.4, label %shortcirc_done.4 br i1 false, label %shortcirc_next.4, label %shortcirc_done.4
shortcirc_next.4: ; preds = %endif.3 shortcirc_next.4: ; preds = %endif.3
br label %shortcirc_done.4 br label %shortcirc_done.4
shortcirc_done.4: ; preds = %shortcirc_next.4, %endif.3 shortcirc_done.4: ; preds = %shortcirc_next.4, %endif.3
br bool false, label %then.4, label %else br i1 false, label %then.4, label %else
then.4: ; preds = %shortcirc_done.4 then.4: ; preds = %shortcirc_done.4
br label %loopentry.1 br label %loopentry.1
loopentry.1: ; preds = %endif.8, %then.4 loopentry.1: ; preds = %endif.8, %then.4
br bool false, label %no_exit, label %loopexit.1 br i1 false, label %no_exit, label %loopexit.1
no_exit: ; preds = %loopentry.1 no_exit: ; preds = %loopentry.1
%tmp.94 = call int %opost_block( ) ; <int> [#uses=1] %tmp.94 = call i32 @opost_block( ) ; <i32> [#uses=1]
br bool false, label %then.5, label %endif.5 br i1 false, label %then.5, label %endif.5
then.5: ; preds = %no_exit then.5: ; preds = %no_exit
br bool false, label %then.6, label %endif.6 br i1 false, label %then.6, label %endif.6
then.6: ; preds = %then.5 then.6: ; preds = %then.5
br label %loopexit.1 br label %loopexit.1
dead_block_after_break.2: ; No predecessors! dead_block_after_break.2: ; No predecessors!
br label %endif.6 br label %endif.6
endif.6: ; preds = %dead_block_after_break.2, %then.5 endif.6: ; preds = %dead_block_after_break.2, %then.5
br label %break_out br label %break_out
dead_block_after_goto.0: ; No predecessors! dead_block_after_goto.0: ; No predecessors!
br label %endif.5 br label %endif.5
endif.5: ; preds = %dead_block_after_goto.0, %no_exit endif.5: ; preds = %dead_block_after_goto.0, %no_exit
br bool false, label %then.7, label %endif.7 br i1 false, label %then.7, label %endif.7
then.7: ; preds = %endif.5 then.7: ; preds = %endif.5
br label %loopexit.1 br label %loopexit.1
dead_block_after_break.3: ; No predecessors! dead_block_after_break.3: ; No predecessors!
br label %endif.7 br label %endif.7
endif.7: ; preds = %dead_block_after_break.3, %endif.5 endif.7: ; preds = %dead_block_after_break.3, %endif.5
switch uint 1, label %switchexit [ switch i32 1, label %switchexit [
uint 4, label %label.2 i32 4, label %label.2
uint 2, label %label.1 i32 2, label %label.1
uint 1, label %label.0 i32 1, label %label.0
] ]
label.0: ; preds = %endif.7 label.0: ; preds = %endif.7
br label %switchexit br label %switchexit
dead_block_after_break.4: ; No predecessors! dead_block_after_break.4: ; No predecessors!
br label %label.1 br label %label.1
label.1: ; preds = %dead_block_after_break.4, %endif.7 label.1: ; preds = %dead_block_after_break.4, %endif.7
br label %switchexit br label %switchexit
dead_block_after_break.5: ; No predecessors! dead_block_after_break.5: ; No predecessors!
br label %label.2 br label %label.2
label.2: ; preds = %dead_block_after_break.5, %endif.7 label.2: ; preds = %dead_block_after_break.5, %endif.7
br label %switchexit br label %switchexit
dead_block_after_break.6: ; No predecessors! dead_block_after_break.6: ; No predecessors!
br label %switchexit br label %switchexit
switchexit: ; preds = %dead_block_after_break.6, %label.2, %label.1, %label.0, %endif.7 switchexit: ; preds = %dead_block_after_break.6, %label.2, %label.1, %label.0, %endif.7
br bool false, label %then.8, label %endif.8 br i1 false, label %then.8, label %endif.8
then.8: ; preds = %switchexit then.8: ; preds = %switchexit
br label %loopexit.1 br label %loopexit.1
dead_block_after_break.7: ; No predecessors! dead_block_after_break.7: ; No predecessors!
br label %endif.8 br label %endif.8
endif.8: ; preds = %dead_block_after_break.7, %switchexit endif.8: ; preds = %dead_block_after_break.7, %switchexit
br label %loopentry.1 br label %loopentry.1
loopexit.1: ; preds = %then.8, %then.7, %then.6, %loopentry.1 loopexit.1: ; preds = %then.8, %then.7, %then.6, %loopentry.1
br bool false, label %then.9, label %endif.9 br i1 false, label %then.9, label %endif.9
then.9: ; preds = %loopexit.1 then.9: ; preds = %loopexit.1
br label %endif.9 br label %endif.9
endif.9: ; preds = %then.9, %loopexit.1 endif.9: ; preds = %then.9, %loopexit.1
br label %endif.4 br label %endif.4
else: ; preds = %shortcirc_done.4 else: ; preds = %shortcirc_done.4
br bool false, label %then.10, label %endif.10 br i1 false, label %then.10, label %endif.10
then.10: ; preds = %else then.10: ; preds = %else
br label %break_out br label %break_out
dead_block_after_goto.1: ; No predecessors! dead_block_after_goto.1: ; No predecessors!
br label %endif.10 br label %endif.10
endif.10: ; preds = %dead_block_after_goto.1, %else endif.10: ; preds = %dead_block_after_goto.1, %else
br label %endif.4 br label %endif.4
endif.4: ; preds = %endif.10, %endif.9 endif.4: ; preds = %endif.10, %endif.9
br bool false, label %then.11, label %endif.11 br i1 false, label %then.11, label %endif.11
then.11: ; preds = %endif.4 then.11: ; preds = %endif.4
br label %loopexit.0 br label %loopexit.0
dead_block_after_break.8: ; No predecessors! dead_block_after_break.8: ; No predecessors!
br label %endif.11 br label %endif.11
endif.11: ; preds = %dead_block_after_break.8, %endif.4 endif.11: ; preds = %dead_block_after_break.8, %endif.4
br bool false, label %then.12, label %endif.12 br i1 false, label %then.12, label %endif.12
then.12: ; preds = %endif.11 then.12: ; preds = %endif.11
br label %loopexit.0 br label %loopexit.0
dead_block_after_break.9: ; No predecessors! dead_block_after_break.9: ; No predecessors!
br label %endif.12 br label %endif.12
endif.12: ; preds = %dead_block_after_break.9, %endif.11 endif.12: ; preds = %dead_block_after_break.9, %endif.11
br label %loopentry.0 br label %loopentry.0
loopexit.0: ; preds = %then.12, %then.11, %then.3, %then.2 loopexit.0: ; preds = %then.12, %then.11, %then.3, %then.2
br label %break_out br label %break_out
break_out: ; preds = %loopexit.0, %then.10, %endif.6 break_out: ; preds = %loopexit.0, %then.10, %endif.6
%retval.3 = phi int [ 0, %loopexit.0 ], [ %tmp.94, %endif.6 ], [ 0, %then.10 ] ; <int> [#uses=0] %retval.3 = phi i32 [ 0, %loopexit.0 ], [ %tmp.94, %endif.6 ], [ 0, %then.10 ] ; <i32> [#uses=0]
br bool false, label %cond_true, label %cond_false br i1 false, label %cond_true, label %cond_false
cond_true: ; preds = %break_out cond_true: ; preds = %break_out
br label %cond_continue br label %cond_continue
cond_false: ; preds = %break_out cond_false: ; preds = %break_out
br label %cond_continue br label %cond_continue
cond_continue: ; preds = %cond_false, %cond_true cond_continue: ; preds = %cond_false, %cond_true
br label %return br label %return
after_ret.1: ; No predecessors! after_ret.1: ; No predecessors!
br label %return br label %return
return: ; preds = %after_ret.1, %cond_continue, %then.1 return: ; preds = %after_ret.1, %cond_continue, %then.1
ret void ret void
} }

View File

@ -1,270 +1,184 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -lcssa -disable-output ; RUN: llvm-as < %s | opt -lcssa -disable-output
; PR977 ; PR977
; END.
void %process_backlog() { define void @process_backlog() {
entry: entry:
br label %loopentry.preheader br label %loopentry.preheader
loopentry.preheader: ; preds = %dead_block_after_break, %entry loopentry.preheader: ; preds = %dead_block_after_break, %entry
%work.0.ph = phi int [ %inc, %dead_block_after_break ], [ 0, %entry ] ; <int> [#uses=0] %work.0.ph = phi i32 [ %inc, %dead_block_after_break ], [ 0, %entry ] ; <i32> [#uses=0]
br label %loopentry br label %loopentry
loopentry: ; preds = %endif.1, %loopentry.preheader loopentry: ; preds = %endif.1, %loopentry.preheader
br bool false, label %then.i, label %loopentry.__skb_dequeue67.exit_crit_edge br i1 false, label %then.i, label %loopentry.__skb_dequeue67.exit_crit_edge
loopentry.__skb_dequeue67.exit_crit_edge: ; preds = %loopentry loopentry.__skb_dequeue67.exit_crit_edge: ; preds = %loopentry
br label %__skb_dequeue67.exit br label %__skb_dequeue67.exit
then.i: ; preds = %loopentry then.i: ; preds = %loopentry
br label %__skb_dequeue67.exit br label %__skb_dequeue67.exit
__skb_dequeue67.exit: ; preds = %then.i, %loopentry.__skb_dequeue67.exit_crit_edge __skb_dequeue67.exit: ; preds = %then.i, %loopentry.__skb_dequeue67.exit_crit_edge
br bool false, label %then.0, label %__skb_dequeue67.exit.endif.0_crit_edge br i1 false, label %then.0, label %__skb_dequeue67.exit.endif.0_crit_edge
__skb_dequeue67.exit.endif.0_crit_edge: ; preds = %__skb_dequeue67.exit __skb_dequeue67.exit.endif.0_crit_edge: ; preds = %__skb_dequeue67.exit
br label %endif.0 br label %endif.0
then.0: ; preds = %__skb_dequeue67.exit then.0: ; preds = %__skb_dequeue67.exit
br label %job_done br label %job_done
dead_block_after_goto: ; No predecessors! dead_block_after_goto: ; No predecessors!
unreachable unreachable
endif.0: ; preds = %__skb_dequeue67.exit.endif.0_crit_edge endif.0: ; preds = %__skb_dequeue67.exit.endif.0_crit_edge
br bool false, label %then.0.i, label %endif.0.endif.0.i_crit_edge br i1 false, label %then.0.i, label %endif.0.endif.0.i_crit_edge
endif.0.endif.0.i_crit_edge: ; preds = %endif.0 endif.0.endif.0.i_crit_edge: ; preds = %endif.0
br label %endif.0.i br label %endif.0.i
then.0.i: ; preds = %endif.0 then.0.i: ; preds = %endif.0
br label %endif.0.i br label %endif.0.i
endif.0.i: ; preds = %then.0.i, %endif.0.endif.0.i_crit_edge endif.0.i: ; preds = %then.0.i, %endif.0.endif.0.i_crit_edge
br bool false, label %then.i.i, label %endif.0.i.skb_bond.exit.i_crit_edge br i1 false, label %then.i.i, label %endif.0.i.skb_bond.exit.i_crit_edge
endif.0.i.skb_bond.exit.i_crit_edge: ; preds = %endif.0.i endif.0.i.skb_bond.exit.i_crit_edge: ; preds = %endif.0.i
br label %skb_bond.exit.i br label %skb_bond.exit.i
then.i.i: ; preds = %endif.0.i then.i.i: ; preds = %endif.0.i
br label %skb_bond.exit.i br label %skb_bond.exit.i
skb_bond.exit.i: ; preds = %then.i.i, %endif.0.i.skb_bond.exit.i_crit_edge skb_bond.exit.i: ; preds = %then.i.i, %endif.0.i.skb_bond.exit.i_crit_edge
br label %loopentry.0.i br label %loopentry.0.i
loopentry.0.i: ; preds = %loopentry.0.i.backedge, %skb_bond.exit.i loopentry.0.i: ; preds = %loopentry.0.i.backedge, %skb_bond.exit.i
br bool false, label %loopentry.0.i.no_exit.0.i_crit_edge, label %loopentry.0.i.loopexit.0.i_crit_edge br i1 false, label %loopentry.0.i.no_exit.0.i_crit_edge, label %loopentry.0.i.loopexit.0.i_crit_edge
loopentry.0.i.loopexit.0.i_crit_edge: ; preds = %loopentry.0.i loopentry.0.i.loopexit.0.i_crit_edge: ; preds = %loopentry.0.i
br label %loopexit.0.i br label %loopexit.0.i
loopentry.0.i.no_exit.0.i_crit_edge: ; preds = %loopentry.0.i loopentry.0.i.no_exit.0.i_crit_edge: ; preds = %loopentry.0.i
br label %no_exit.0.i br label %no_exit.0.i
no_exit.0.i: ; preds = %then.3.i.no_exit.0.i_crit_edge, %loopentry.0.i.no_exit.0.i_crit_edge no_exit.0.i: ; preds = %then.3.i.no_exit.0.i_crit_edge, %loopentry.0.i.no_exit.0.i_crit_edge
br bool false, label %no_exit.0.i.shortcirc_done.0.i_crit_edge, label %shortcirc_next.0.i br i1 false, label %no_exit.0.i.shortcirc_done.0.i_crit_edge, label %shortcirc_next.0.i
no_exit.0.i.shortcirc_done.0.i_crit_edge: ; preds = %no_exit.0.i no_exit.0.i.shortcirc_done.0.i_crit_edge: ; preds = %no_exit.0.i
br label %shortcirc_done.0.i br label %shortcirc_done.0.i
shortcirc_next.0.i: ; preds = %no_exit.0.i shortcirc_next.0.i: ; preds = %no_exit.0.i
br label %shortcirc_done.0.i br label %shortcirc_done.0.i
shortcirc_done.0.i: ; preds = %shortcirc_next.0.i, %no_exit.0.i.shortcirc_done.0.i_crit_edge shortcirc_done.0.i: ; preds = %shortcirc_next.0.i, %no_exit.0.i.shortcirc_done.0.i_crit_edge
br bool false, label %then.1.i, label %endif.1.i br i1 false, label %then.1.i, label %endif.1.i
then.1.i: ; preds = %shortcirc_done.0.i then.1.i: ; preds = %shortcirc_done.0.i
br bool false, label %then.2.i, label %then.1.i.endif.2.i_crit_edge br i1 false, label %then.2.i, label %then.1.i.endif.2.i_crit_edge
then.1.i.endif.2.i_crit_edge: ; preds = %then.1.i then.1.i.endif.2.i_crit_edge: ; preds = %then.1.i
br label %endif.2.i br label %endif.2.i
then.2.i: ; preds = %then.1.i then.2.i: ; preds = %then.1.i
br bool false, label %then.3.i, label %else.0.i br i1 false, label %then.3.i, label %else.0.i
then.3.i: ; preds = %then.2.i then.3.i: ; preds = %then.2.i
br bool false, label %then.3.i.no_exit.0.i_crit_edge, label %then.3.i.loopexit.0.i_crit_edge br i1 false, label %then.3.i.no_exit.0.i_crit_edge, label %then.3.i.loopexit.0.i_crit_edge
then.3.i.loopexit.0.i_crit_edge: ; preds = %then.3.i then.3.i.loopexit.0.i_crit_edge: ; preds = %then.3.i
br label %loopexit.0.i br label %loopexit.0.i
then.3.i.no_exit.0.i_crit_edge: ; preds = %then.3.i then.3.i.no_exit.0.i_crit_edge: ; preds = %then.3.i
br label %no_exit.0.i br label %no_exit.0.i
else.0.i: ; preds = %then.2.i else.0.i: ; preds = %then.2.i
br label %endif.2.i br label %endif.2.i
endif.3.i: ; No predecessors! endif.3.i: ; No predecessors!
unreachable unreachable
endif.2.i: ; preds = %else.0.i, %then.1.i.endif.2.i_crit_edge endif.2.i: ; preds = %else.0.i, %then.1.i.endif.2.i_crit_edge
br label %loopentry.0.i.backedge br label %loopentry.0.i.backedge
endif.1.i: ; preds = %shortcirc_done.0.i endif.1.i: ; preds = %shortcirc_done.0.i
br label %loopentry.0.i.backedge br label %loopentry.0.i.backedge
loopentry.0.i.backedge: ; preds = %endif.1.i, %endif.2.i loopentry.0.i.backedge: ; preds = %endif.1.i, %endif.2.i
br label %loopentry.0.i br label %loopentry.0.i
loopexit.0.i: ; preds = %then.3.i.loopexit.0.i_crit_edge, %loopentry.0.i.loopexit.0.i_crit_edge loopexit.0.i: ; preds = %then.3.i.loopexit.0.i_crit_edge, %loopentry.0.i.loopexit.0.i_crit_edge
br label %loopentry.1.i br label %loopentry.1.i
loopentry.1.i: ; preds = %loopentry.1.i.backedge, %loopexit.0.i loopentry.1.i: ; preds = %loopentry.1.i.backedge, %loopexit.0.i
br bool false, label %loopentry.1.i.no_exit.1.i_crit_edge, label %loopentry.1.i.loopexit.1.i_crit_edge br i1 false, label %loopentry.1.i.no_exit.1.i_crit_edge, label %loopentry.1.i.loopexit.1.i_crit_edge
loopentry.1.i.loopexit.1.i_crit_edge: ; preds = %loopentry.1.i loopentry.1.i.loopexit.1.i_crit_edge: ; preds = %loopentry.1.i
br label %loopexit.1.i br label %loopexit.1.i
loopentry.1.i.no_exit.1.i_crit_edge: ; preds = %loopentry.1.i loopentry.1.i.no_exit.1.i_crit_edge: ; preds = %loopentry.1.i
br label %no_exit.1.i br label %no_exit.1.i
no_exit.1.i: ; preds = %then.6.i.no_exit.1.i_crit_edge, %loopentry.1.i.no_exit.1.i_crit_edge no_exit.1.i: ; preds = %then.6.i.no_exit.1.i_crit_edge, %loopentry.1.i.no_exit.1.i_crit_edge
br bool false, label %shortcirc_next.1.i, label %no_exit.1.i.shortcirc_done.1.i_crit_edge br i1 false, label %shortcirc_next.1.i, label %no_exit.1.i.shortcirc_done.1.i_crit_edge
no_exit.1.i.shortcirc_done.1.i_crit_edge: ; preds = %no_exit.1.i no_exit.1.i.shortcirc_done.1.i_crit_edge: ; preds = %no_exit.1.i
br label %shortcirc_done.1.i br label %shortcirc_done.1.i
shortcirc_next.1.i: ; preds = %no_exit.1.i shortcirc_next.1.i: ; preds = %no_exit.1.i
br bool false, label %shortcirc_next.1.i.shortcirc_done.2.i_crit_edge, label %shortcirc_next.2.i br i1 false, label %shortcirc_next.1.i.shortcirc_done.2.i_crit_edge, label %shortcirc_next.2.i
shortcirc_next.1.i.shortcirc_done.2.i_crit_edge: ; preds = %shortcirc_next.1.i shortcirc_next.1.i.shortcirc_done.2.i_crit_edge: ; preds = %shortcirc_next.1.i
br label %shortcirc_done.2.i br label %shortcirc_done.2.i
shortcirc_next.2.i: ; preds = %shortcirc_next.1.i shortcirc_next.2.i: ; preds = %shortcirc_next.1.i
br label %shortcirc_done.2.i br label %shortcirc_done.2.i
shortcirc_done.2.i: ; preds = %shortcirc_next.2.i, %shortcirc_next.1.i.shortcirc_done.2.i_crit_edge shortcirc_done.2.i: ; preds = %shortcirc_next.2.i, %shortcirc_next.1.i.shortcirc_done.2.i_crit_edge
br label %shortcirc_done.1.i br label %shortcirc_done.1.i
shortcirc_done.1.i: ; preds = %shortcirc_done.2.i, %no_exit.1.i.shortcirc_done.1.i_crit_edge shortcirc_done.1.i: ; preds = %shortcirc_done.2.i, %no_exit.1.i.shortcirc_done.1.i_crit_edge
br bool false, label %then.4.i, label %endif.4.i br i1 false, label %then.4.i, label %endif.4.i
then.4.i: ; preds = %shortcirc_done.1.i then.4.i: ; preds = %shortcirc_done.1.i
br bool false, label %then.5.i, label %then.4.i.endif.5.i_crit_edge br i1 false, label %then.5.i, label %then.4.i.endif.5.i_crit_edge
then.4.i.endif.5.i_crit_edge: ; preds = %then.4.i then.4.i.endif.5.i_crit_edge: ; preds = %then.4.i
br label %endif.5.i br label %endif.5.i
then.5.i: ; preds = %then.4.i then.5.i: ; preds = %then.4.i
br bool false, label %then.6.i, label %else.1.i br i1 false, label %then.6.i, label %else.1.i
then.6.i: ; preds = %then.5.i then.6.i: ; preds = %then.5.i
br bool false, label %then.6.i.no_exit.1.i_crit_edge, label %then.6.i.loopexit.1.i_crit_edge br i1 false, label %then.6.i.no_exit.1.i_crit_edge, label %then.6.i.loopexit.1.i_crit_edge
then.6.i.loopexit.1.i_crit_edge: ; preds = %then.6.i then.6.i.loopexit.1.i_crit_edge: ; preds = %then.6.i
br label %loopexit.1.i br label %loopexit.1.i
then.6.i.no_exit.1.i_crit_edge: ; preds = %then.6.i then.6.i.no_exit.1.i_crit_edge: ; preds = %then.6.i
br label %no_exit.1.i br label %no_exit.1.i
else.1.i: ; preds = %then.5.i else.1.i: ; preds = %then.5.i
br label %endif.5.i br label %endif.5.i
endif.6.i: ; No predecessors! endif.6.i: ; No predecessors!
unreachable unreachable
endif.5.i: ; preds = %else.1.i, %then.4.i.endif.5.i_crit_edge endif.5.i: ; preds = %else.1.i, %then.4.i.endif.5.i_crit_edge
br label %loopentry.1.i.backedge br label %loopentry.1.i.backedge
endif.4.i: ; preds = %shortcirc_done.1.i endif.4.i: ; preds = %shortcirc_done.1.i
br label %loopentry.1.i.backedge br label %loopentry.1.i.backedge
loopentry.1.i.backedge: ; preds = %endif.4.i, %endif.5.i loopentry.1.i.backedge: ; preds = %endif.4.i, %endif.5.i
br label %loopentry.1.i br label %loopentry.1.i
loopexit.1.i: ; preds = %then.6.i.loopexit.1.i_crit_edge, %loopentry.1.i.loopexit.1.i_crit_edge loopexit.1.i: ; preds = %then.6.i.loopexit.1.i_crit_edge, %loopentry.1.i.loopexit.1.i_crit_edge
br bool false, label %then.7.i, label %else.2.i br i1 false, label %then.7.i, label %else.2.i
then.7.i: ; preds = %loopexit.1.i then.7.i: ; preds = %loopexit.1.i
br bool false, label %then.8.i, label %else.3.i br i1 false, label %then.8.i, label %else.3.i
then.8.i: ; preds = %then.7.i then.8.i: ; preds = %then.7.i
br label %netif_receive_skb.exit br label %netif_receive_skb.exit
else.3.i: ; preds = %then.7.i else.3.i: ; preds = %then.7.i
br label %netif_receive_skb.exit br label %netif_receive_skb.exit
endif.8.i: ; No predecessors! endif.8.i: ; No predecessors!
unreachable unreachable
else.2.i: ; preds = %loopexit.1.i else.2.i: ; preds = %loopexit.1.i
br bool false, label %else.2.i.shortcirc_done.i.i_crit_edge, label %shortcirc_next.i.i br i1 false, label %else.2.i.shortcirc_done.i.i_crit_edge, label %shortcirc_next.i.i
else.2.i.shortcirc_done.i.i_crit_edge: ; preds = %else.2.i else.2.i.shortcirc_done.i.i_crit_edge: ; preds = %else.2.i
br label %shortcirc_done.i.i br label %shortcirc_done.i.i
shortcirc_next.i.i: ; preds = %else.2.i shortcirc_next.i.i: ; preds = %else.2.i
br label %shortcirc_done.i.i br label %shortcirc_done.i.i
shortcirc_done.i.i: ; preds = %shortcirc_next.i.i, %else.2.i.shortcirc_done.i.i_crit_edge shortcirc_done.i.i: ; preds = %shortcirc_next.i.i, %else.2.i.shortcirc_done.i.i_crit_edge
br bool false, label %then.i1.i, label %shortcirc_done.i.i.kfree_skb65.exit.i_crit_edge br i1 false, label %then.i1.i, label %shortcirc_done.i.i.kfree_skb65.exit.i_crit_edge
shortcirc_done.i.i.kfree_skb65.exit.i_crit_edge: ; preds = %shortcirc_done.i.i shortcirc_done.i.i.kfree_skb65.exit.i_crit_edge: ; preds = %shortcirc_done.i.i
br label %kfree_skb65.exit.i br label %kfree_skb65.exit.i
then.i1.i: ; preds = %shortcirc_done.i.i then.i1.i: ; preds = %shortcirc_done.i.i
br label %kfree_skb65.exit.i br label %kfree_skb65.exit.i
kfree_skb65.exit.i: ; preds = %then.i1.i, %shortcirc_done.i.i.kfree_skb65.exit.i_crit_edge kfree_skb65.exit.i: ; preds = %then.i1.i, %shortcirc_done.i.i.kfree_skb65.exit.i_crit_edge
br label %netif_receive_skb.exit br label %netif_receive_skb.exit
netif_receive_skb.exit: ; preds = %kfree_skb65.exit.i, %else.3.i, %then.8.i netif_receive_skb.exit: ; preds = %kfree_skb65.exit.i, %else.3.i, %then.8.i
br bool false, label %then.i1, label %netif_receive_skb.exit.dev_put69.exit_crit_edge br i1 false, label %then.i1, label %netif_receive_skb.exit.dev_put69.exit_crit_edge
netif_receive_skb.exit.dev_put69.exit_crit_edge: ; preds = %netif_receive_skb.exit netif_receive_skb.exit.dev_put69.exit_crit_edge: ; preds = %netif_receive_skb.exit
br label %dev_put69.exit br label %dev_put69.exit
then.i1: ; preds = %netif_receive_skb.exit then.i1: ; preds = %netif_receive_skb.exit
br label %dev_put69.exit br label %dev_put69.exit
dev_put69.exit: ; preds = %then.i1, %netif_receive_skb.exit.dev_put69.exit_crit_edge dev_put69.exit: ; preds = %then.i1, %netif_receive_skb.exit.dev_put69.exit_crit_edge
%inc = add int 0, 1 ; <int> [#uses=1] %inc = add i32 0, 1 ; <i32> [#uses=1]
br bool false, label %dev_put69.exit.shortcirc_done_crit_edge, label %shortcirc_next br i1 false, label %dev_put69.exit.shortcirc_done_crit_edge, label %shortcirc_next
dev_put69.exit.shortcirc_done_crit_edge: ; preds = %dev_put69.exit dev_put69.exit.shortcirc_done_crit_edge: ; preds = %dev_put69.exit
br label %shortcirc_done br label %shortcirc_done
shortcirc_next: ; preds = %dev_put69.exit shortcirc_next: ; preds = %dev_put69.exit
br label %shortcirc_done br label %shortcirc_done
shortcirc_done: ; preds = %shortcirc_next, %dev_put69.exit.shortcirc_done_crit_edge shortcirc_done: ; preds = %shortcirc_next, %dev_put69.exit.shortcirc_done_crit_edge
br bool false, label %then.1, label %endif.1 br i1 false, label %then.1, label %endif.1
then.1: ; preds = %shortcirc_done then.1: ; preds = %shortcirc_done
ret void ret void
dead_block_after_break: ; No predecessors! dead_block_after_break: ; No predecessors!
br label %loopentry.preheader br label %loopentry.preheader
endif.1: ; preds = %shortcirc_done endif.1: ; preds = %shortcirc_done
br label %loopentry br label %loopentry
loopexit: ; No predecessors! loopexit: ; No predecessors!
unreachable unreachable
after_ret.0: ; No predecessors! after_ret.0: ; No predecessors!
br label %job_done br label %job_done
job_done: ; preds = %after_ret.0, %then.0 job_done: ; preds = %after_ret.0, %then.0
br label %loopentry.i br label %loopentry.i
loopentry.i: ; preds = %no_exit.i, %job_done loopentry.i: ; preds = %no_exit.i, %job_done
br bool false, label %no_exit.i, label %clear_bit62.exit br i1 false, label %no_exit.i, label %clear_bit62.exit
no_exit.i: ; preds = %loopentry.i no_exit.i: ; preds = %loopentry.i
br label %loopentry.i br label %loopentry.i
clear_bit62.exit: ; preds = %loopentry.i clear_bit62.exit: ; preds = %loopentry.i
br bool false, label %then.2, label %endif.2 br i1 false, label %then.2, label %endif.2
then.2: ; preds = %clear_bit62.exit then.2: ; preds = %clear_bit62.exit
ret void ret void
endif.2: ; preds = %clear_bit62.exit endif.2: ; preds = %clear_bit62.exit
ret void ret void
after_ret.1: ; No predecessors! after_ret.1: ; No predecessors!
ret void ret void
return: ; No predecessors! return: ; No predecessors!
unreachable unreachable
} }

View File

@ -1,28 +1,24 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -lcssa | llvm-dis | \ ; RUN: llvm-as < %s | opt -lcssa | llvm-dis | \
; RUN: grep {X3.lcssa = phi i32} ; RUN: grep {X3.lcssa = phi i32}
; RUN: llvm-upgrade < %s | llvm-as | opt -lcssa | llvm-dis | \ ; RUN: llvm-as < %s | opt -lcssa | llvm-dis | \
; RUN: grep {X4 = add i32 3, %X3.lcssa} ; RUN: grep {X4 = add i32 3, %X3.lcssa}
void %lcssa(bool %S2) { define void @lcssa(i1 %S2) {
entry: entry:
br label %loop.interior br label %loop.interior
loop.interior: ; preds = %post.if, %entry
loop.interior: ; preds = %entry br i1 %S2, label %if.true, label %if.false
br bool %S2, label %if.true, label %if.false if.true: ; preds = %loop.interior
%X1 = add i32 0, 0 ; <i32> [#uses=1]
if.true:
%X1 = add int 0, 0
br label %post.if br label %post.if
if.false: ; preds = %loop.interior
if.false: %X2 = add i32 0, 1 ; <i32> [#uses=1]
%X2 = add int 0, 1
br label %post.if br label %post.if
post.if: ; preds = %if.false, %if.true
post.if: %X3 = phi i32 [ %X1, %if.true ], [ %X2, %if.false ] ; <i32> [#uses=1]
%X3 = phi int [%X1, %if.true], [%X2, %if.false] br i1 %S2, label %loop.exit, label %loop.interior
br bool %S2, label %loop.exit, label %loop.interior loop.exit: ; preds = %post.if
%X4 = add i32 3, %X3 ; <i32> [#uses=0]
loop.exit:
%X4 = add int 3, %X3
ret void ret void
} }

View File

@ -1,27 +1,18 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -loop-rotate -disable-output ; RUN: llvm-as < %s | opt -loop-rotate -disable-output
%struct.relation = type { [4 x i16], i32, [4 x i16], i32, i32 } %struct.relation = type { [4 x i16], i32, [4 x i16], i32, i32 }
define void @findAllPairs() {
void @findAllPairs() {
entry: entry:
br i1 false, label %bb139, label %bb10.i44 br i1 false, label %bb139, label %bb10.i44
bb10.i44: ; preds = %entry bb10.i44: ; preds = %entry
ret void ret void
bb127: ; preds = %bb139 bb127: ; preds = %bb139
br label %bb139 br label %bb139
bb139: ; preds = %bb127, %entry bb139: ; preds = %bb127, %entry
br i1 false, label %bb127, label %bb142 br i1 false, label %bb127, label %bb142
bb142: ; preds = %bb139 bb142: ; preds = %bb139
%r91.0.lcssa = phi %struct.relation* [ null, %bb139 ] ; <%struct.relation*> [#uses=0] %r91.0.lcssa = phi %struct.relation* [ null, %bb139 ] ; <%struct.relation*> [#uses=0]
ret void ret void
} }

View File

@ -1,30 +1,24 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -loop-rotate -disable-output ; RUN: llvm-as < %s | opt -loop-rotate -disable-output
void @findAllPairs() { define void @findAllPairs() {
entry: entry:
br i1 false, label %bb139, label %cond_true br i1 false, label %bb139, label %cond_true
cond_true: ; preds = %entry cond_true: ; preds = %entry
ret void ret void
bb90: ; preds = %bb139 bb90: ; preds = %bb139
br i1 false, label %bb136, label %cond_next121 br i1 false, label %bb136, label %cond_next121
cond_next121: ; preds = %bb90 cond_next121: ; preds = %bb90
br i1 false, label %bb136, label %bb127 br i1 false, label %bb136, label %bb127
bb127: ; preds = %cond_next121 bb127: ; preds = %cond_next121
br label %bb136 br label %bb136
bb136: ; preds = %bb127, %cond_next121, %bb90 bb136: ; preds = %bb127, %cond_next121, %bb90
%changes.1 = phi i32 [ %changes.2, %bb90 ], [ %changes.2, %cond_next121 ], [ 1, %bb127 ] ; <i32> [#uses=1] %changes.1 = phi i32 [ %changes.2, %bb90 ], [ %changes.2, %cond_next121 ], [ 1, %bb127 ] ; <i32> [#uses=1]
br label %bb139 br label %bb139
bb139: ; preds = %bb136, %entry bb139: ; preds = %bb136, %entry
%changes.2 = phi i32 [ %changes.1, %bb136 ], [ 0, %entry ] ; <i32> [#uses=3] %changes.2 = phi i32 [ %changes.1, %bb136 ], [ 0, %entry ] ; <i32> [#uses=3]
br i1 false, label %bb90, label %bb142 br i1 false, label %bb90, label %bb142
bb142: ; preds = %bb139 bb142: ; preds = %bb139
%changes.2.lcssa = phi i32 [ %changes.2, %bb139 ] ; <i32> [#uses=0] %changes.2.lcssa = phi i32 [ %changes.2, %bb139 ] ; <i32> [#uses=0]
ret void ret void
} }

View File

@ -1,41 +1,29 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -loop-rotate -disable-output ; RUN: llvm-as < %s | opt -loop-rotate -disable-output
define void @_ZN9Classfile4readEv() {
void @_ZN9Classfile4readEv() {
entry: entry:
br i1 false, label %cond_false485, label %bb405 br i1 false, label %cond_false485, label %bb405
bb405: ; preds = %entry bb405: ; preds = %entry
ret void ret void
cond_false485: ; preds = %entry cond_false485: ; preds = %entry
br label %bb830 br label %bb830
bb511: ; preds = %bb830 bb511: ; preds = %bb830
br i1 false, label %bb816, label %bb830 br i1 false, label %bb816, label %bb830
cond_next667: ; preds = %bb816 cond_next667: ; preds = %bb816
br i1 false, label %cond_next695, label %bb680 br i1 false, label %cond_next695, label %bb680
bb676: ; preds = %bb680 bb676: ; preds = %bb680
br label %bb680 br label %bb680
bb680: ; preds = %bb676, %cond_next667 bb680: ; preds = %bb676, %cond_next667
%iftmp.68.0 = zext i1 false to i8 ; <i8> [#uses=1] %iftmp.68.0 = zext i1 false to i8 ; <i8> [#uses=1]
br i1 false, label %bb676, label %cond_next695 br i1 false, label %bb676, label %cond_next695
cond_next695: ; preds = %bb680, %cond_next667 cond_next695: ; preds = %bb680, %cond_next667
%iftmp.68.2 = phi i8 [ %iftmp.68.0, %bb680 ], [ undef, %cond_next667 ] ; <i8> [#uses=0] %iftmp.68.2 = phi i8 [ %iftmp.68.0, %bb680 ], [ undef, %cond_next667 ] ; <i8> [#uses=0]
ret void ret void
bb816: ; preds = %bb816, %bb511 bb816: ; preds = %bb816, %bb511
br i1 false, label %cond_next667, label %bb816 br i1 false, label %cond_next667, label %bb816
bb830: ; preds = %bb511, %cond_false485 bb830: ; preds = %bb511, %cond_false485
br i1 false, label %bb511, label %bb835 br i1 false, label %bb511, label %bb835
bb835: ; preds = %bb830 bb835: ; preds = %bb830
ret void ret void
} }

View File

@ -1,20 +1,18 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -loop-rotate -disable-output ; RUN: llvm-as < %s | opt -loop-rotate -disable-output
define void @InterpretSEIMessage(i8* %msg) {
void @InterpretSEIMessage(i8* %msg) {
entry: entry:
br label %bb15 br label %bb15
bb6: ; preds = %bb15 bb6: ; preds = %bb15
%tmp11 = getelementptr i8* %msg, i32 %offset.1 ; <i8*> [#uses=0] %gep.upgrd.1 = zext i32 %offset.1 to i64 ; <i64> [#uses=1]
%tmp11 = getelementptr i8* %msg, i64 %gep.upgrd.1 ; <i8*> [#uses=0]
br label %bb15 br label %bb15
bb15: ; preds = %bb6, %entry bb15: ; preds = %bb6, %entry
%offset.1 = add i32 0, 1 ; <i32> [#uses=2] %offset.1 = add i32 0, 1 ; <i32> [#uses=2]
br i1 false, label %bb6, label %bb17 br i1 false, label %bb6, label %bb17
bb17: ; preds = %bb15 bb17: ; preds = %bb15
%offset.1.lcssa = phi i32 [ %offset.1, %bb15 ] ; <i32> [#uses=0] %offset.1.lcssa = phi i32 [ %offset.1, %bb15 ] ; <i32> [#uses=0]
%payload_type.1.lcssa = phi i32 [ 0, %bb15 ] ; <i32> [#uses=0] %payload_type.1.lcssa = phi i32 [ 0, %bb15 ] ; <i32> [#uses=0]
ret void ret void
} }

View File

@ -1,25 +1,20 @@
; This testcase exposed a problem with the loop identification pass (LoopInfo). ; This testcase exposed a problem with the loop identification pass (LoopInfo).
; Basically, it was incorrectly calculating the loop nesting information. ; Basically, it was incorrectly calculating the loop nesting information.
; ;
; RUN: llvm-upgrade < %s | llvm-as | opt -loopsimplify ; RUN: llvm-as < %s | opt -loopsimplify
implementation ; Functions: define i32 @yylex() {
int %yylex() { ; No predecessors!
br label %loopentry.0 br label %loopentry.0
loopentry.0: ; preds = %else.4, %0
loopentry.0: ; preds = %0, %yy_find_action, %else.4
br label %loopexit.2 br label %loopexit.2
loopexit.2: ; preds = %else.4, %loopexit.2, %loopentry.0
loopexit.2: ; preds = %loopentry.0, %else.4, %loopexit.2 br i1 false, label %loopexit.2, label %else.4
br bool false, label %loopexit.2, label %else.4 yy_find_action: ; preds = %else.4
yy_find_action: ; preds = %loopexit.2, %else.4
br label %else.4 br label %else.4
else.4: ; preds = %yy_find_action, %loopexit.2
else.4: ; preds = %yy_find_action switch i32 0, label %loopexit.2 [
switch uint 0, label %loopexit.2 [ i32 2, label %yy_find_action
uint 2, label %yy_find_action i32 0, label %loopentry.0
uint 0, label %loopentry.0
] ]
} }

View File

@ -2,56 +2,41 @@
; inserted for the "fail" loop, but the exit block of a loop is not updated ; inserted for the "fail" loop, but the exit block of a loop is not updated
; to be the preheader instead of the exit loop itself. ; to be the preheader instead of the exit loop itself.
; RUN: llvm-upgrade < %s | llvm-as | opt -loopsimplify ; RUN: llvm-as < %s | opt -loopsimplify
define i32 @re_match_2() {
int %re_match_2() {
br label %loopentry.1 br label %loopentry.1
loopentry.1: ; preds = %endif.82, %0
loopentry.1: ; preds = %then.6, %endif.7, %loopexit.20, %endif.83
br label %shortcirc_done.36 br label %shortcirc_done.36
shortcirc_done.36: ; preds = %loopentry.1
shortcirc_done.36: ; preds = %label.13, %shortcirc_next.36 br i1 false, label %fail, label %endif.40
br bool false, label %fail, label %endif.40
endif.40: ; preds = %shortcirc_done.36 endif.40: ; preds = %shortcirc_done.36
br label %loopexit.20 br label %loopexit.20
loopentry.20: ; preds = %endif.46
loopentry.20: ; preds = %shortcirc_done.40, %endif.46
br label %loopexit.20 br label %loopexit.20
loopexit.20: ; preds = %loopentry.20, %endif.40
loopexit.20: ; preds = %loopentry.20
br label %loopentry.21 br label %loopentry.21
loopentry.21: ; preds = %no_exit.19, %loopexit.20
loopentry.21: ; preds = %loopexit.20, %no_exit.19 br i1 false, label %no_exit.19, label %loopexit.21
br bool false, label %no_exit.19, label %loopexit.21
no_exit.19: ; preds = %loopentry.21 no_exit.19: ; preds = %loopentry.21
br bool false, label %fail, label %loopentry.21 br i1 false, label %fail, label %loopentry.21
loopexit.21: ; preds = %loopentry.21 loopexit.21: ; preds = %loopentry.21
br label %endif.45 br label %endif.45
endif.45: ; preds = %loopexit.21 endif.45: ; preds = %loopexit.21
br label %cond_true.15 br label %cond_true.15
cond_true.15: ; preds = %endif.45 cond_true.15: ; preds = %endif.45
br bool false, label %fail, label %endif.46 br i1 false, label %fail, label %endif.46
endif.46: ; preds = %cond_true.15 endif.46: ; preds = %cond_true.15
br label %loopentry.20 br label %loopentry.20
fail: ; preds = %loopexit.37, %cond_true.15, %no_exit.19, %shortcirc_done.36
fail: ; preds = %shortcirc_done.36, %loopexit.37, %cond_true.15, %no_exit.19
br label %then.80 br label %then.80
then.80: ; preds = %fail then.80: ; preds = %fail
br label %endif.81 br label %endif.81
endif.81: ; preds = %then.80 endif.81: ; preds = %then.80
br label %loopexit.37 br label %loopexit.37
loopexit.37: ; preds = %endif.81 loopexit.37: ; preds = %endif.81
br bool false, label %fail, label %endif.82 br i1 false, label %fail, label %endif.82
endif.82: ; preds = %loopexit.37 endif.82: ; preds = %loopexit.37
br label %loopentry.1 br label %loopentry.1
} }

View File

@ -1,65 +1,52 @@
; RUN: llvm-upgrade < %s | llvm-as | opt -tailduplicate -instcombine -simplifycfg -licm -disable-output ; RUN: llvm-as < %s | opt -tailduplicate -instcombine -simplifycfg -licm -disable-output
target datalayout = "e-p:32:32"
@yy_base = external global [787 x i16] ; <[787 x i16]*> [#uses=1]
@yy_state_ptr = external global i32* ; <i32**> [#uses=3]
@yy_state_buf = external global [16386 x i32] ; <[16386 x i32]*> [#uses=1]
@yy_lp = external global i32 ; <i32*> [#uses=1]
target endian = little define i32 @_yylex() {
target pointersize = 32
%yy_base = external global [787 x short] ; <[787 x short]*> [#uses=1]
%yy_state_ptr = external global int* ; <int**> [#uses=3]
%yy_state_buf = external global [16386 x int] ; <[16386 x int]*> [#uses=1]
%yy_lp = external global int ; <int*> [#uses=1]
implementation ; Functions:
int %_yylex() { ; No predecessors!
br label %loopentry.0 br label %loopentry.0
loopentry.0: ; preds = %else.26, %0
loopentry.0: ; preds = %0, %else.26 store i32* getelementptr ([16386 x i32]* @yy_state_buf, i64 0, i64 0), i32** @yy_state_ptr
store int* getelementptr ([16386 x int]* %yy_state_buf, long 0, long 0), int** %yy_state_ptr %tmp.35 = load i32** @yy_state_ptr ; <i32*> [#uses=2]
%tmp.35 = load int** %yy_state_ptr ; <int*> [#uses=2] %inc.0 = getelementptr i32* %tmp.35, i64 1 ; <i32*> [#uses=1]
%inc.0 = getelementptr int* %tmp.35, long 1 ; <int*> [#uses=1] store i32* %inc.0, i32** @yy_state_ptr
store int* %inc.0, int** %yy_state_ptr %tmp.36 = load i32* null ; <i32> [#uses=1]
%tmp.36 = load int* null ; <int> [#uses=1] store i32 %tmp.36, i32* %tmp.35
store int %tmp.36, int* %tmp.35
br label %loopexit.2 br label %loopexit.2
loopexit.2: ; preds = %else.26, %loopexit.2, %loopentry.0
loopexit.2: ; preds = %loopentry.0, %else.26, %loopexit.2 store i8* null, i8** null
store sbyte* null, sbyte** null %tmp.91 = load i32* null ; <i32> [#uses=1]
%tmp.91 = load int* null ; <int> [#uses=1] %tmp.92 = sext i32 %tmp.91 to i64 ; <i64> [#uses=1]
%tmp.92 = cast int %tmp.91 to long ; <long> [#uses=1] %tmp.93 = getelementptr [787 x i16]* @yy_base, i64 0, i64 %tmp.92 ; <i16*> [#uses=1]
%tmp.93 = getelementptr [787 x short]* %yy_base, long 0, long %tmp.92 ; <short*> [#uses=1] %tmp.94 = load i16* %tmp.93 ; <i16> [#uses=1]
%tmp.94 = load short* %tmp.93 ; <short> [#uses=1] %tmp.95 = icmp ne i16 %tmp.94, 4394 ; <i1> [#uses=1]
%tmp.95 = setne short %tmp.94, 4394 ; <bool> [#uses=1] br i1 %tmp.95, label %loopexit.2, label %yy_find_action
br bool %tmp.95, label %loopexit.2, label %yy_find_action yy_find_action: ; preds = %else.26, %loopexit.2
yy_find_action: ; preds = %loopexit.2, %else.26
br label %loopentry.3 br label %loopentry.3
loopentry.3: ; preds = %then.9, %shortcirc_done.0, %yy_find_action
loopentry.3: ; preds = %yy_find_action, %shortcirc_done.0, %then.9 %tmp.105 = load i32* @yy_lp ; <i32> [#uses=1]
%tmp.105 = load int* %yy_lp ; <int> [#uses=1] %tmp.106 = icmp ne i32 %tmp.105, 0 ; <i1> [#uses=1]
%tmp.106 = setne int %tmp.105, 0 ; <bool> [#uses=1] br i1 %tmp.106, label %shortcirc_next.0, label %shortcirc_done.0
br bool %tmp.106, label %shortcirc_next.0, label %shortcirc_done.0
shortcirc_next.0: ; preds = %loopentry.3 shortcirc_next.0: ; preds = %loopentry.3
%tmp.114 = load short* null ; <short> [#uses=1] %tmp.114 = load i16* null ; <i16> [#uses=1]
%tmp.115 = cast short %tmp.114 to int ; <int> [#uses=1] %tmp.115 = sext i16 %tmp.114 to i32 ; <i32> [#uses=1]
%tmp.116 = setlt int 0, %tmp.115 ; <bool> [#uses=1] %tmp.116 = icmp slt i32 0, %tmp.115 ; <i1> [#uses=1]
br label %shortcirc_done.0 br label %shortcirc_done.0
shortcirc_done.0: ; preds = %shortcirc_next.0, %loopentry.3
shortcirc_done.0: ; preds = %loopentry.3, %shortcirc_next.0 %shortcirc_val.0 = phi i1 [ false, %loopentry.3 ], [ %tmp.116, %shortcirc_next.0 ] ; <i1> [#uses=1]
%shortcirc_val.0 = phi bool [ false, %loopentry.3 ], [ %tmp.116, %shortcirc_next.0 ] ; <bool> [#uses=1] br i1 %shortcirc_val.0, label %else.0, label %loopentry.3
br bool %shortcirc_val.0, label %else.0, label %loopentry.3
else.0: ; preds = %shortcirc_done.0 else.0: ; preds = %shortcirc_done.0
%tmp.144 = load int* null ; <int> [#uses=1] %tmp.144 = load i32* null ; <i32> [#uses=1]
%tmp.145 = and int %tmp.144, 8192 ; <int> [#uses=1] %tmp.145 = and i32 %tmp.144, 8192 ; <i32> [#uses=1]
%tmp.146 = setne int %tmp.145, 0 ; <bool> [#uses=1] %tmp.146 = icmp ne i32 %tmp.145, 0 ; <i1> [#uses=1]
br bool %tmp.146, label %then.9, label %else.26 br i1 %tmp.146, label %then.9, label %else.26
then.9: ; preds = %else.0 then.9: ; preds = %else.0
br label %loopentry.3 br label %loopentry.3
else.26: ; preds = %else.0
else.26: ; preds = %else.1 switch i32 0, label %loopentry.0 [
switch uint 0, label %loopentry.0 [ i32 2, label %yy_find_action
uint 2, label %yy_find_action i32 0, label %loopexit.2
uint 0, label %loopexit.2
] ]
} }

View File

@ -4,39 +4,33 @@
; ;
; This is distilled from a monsterous crafty example. ; This is distilled from a monsterous crafty example.
; RUN: llvm-upgrade < %s | llvm-as | opt -licm -disable-output ; RUN: llvm-as < %s | opt -licm -disable-output
%G = weak global int 0 ; <int*> [#uses=13]
implementation ; Functions: @G = weak global i32 0 ; <i32*> [#uses=7]
int %main() { define i32 @main() {
entry: entry:
store int 123, int* %G store i32 123, i32* @G
br label %loopentry.i br label %loopentry.i
loopentry.i: ; preds = %endif.1.i, %entry
loopentry.i: ; preds = %entry, %endif.1.i %tmp.0.i = load i32* @G ; <i32> [#uses=1]
%tmp.0.i = load int* %G ; <int> [#uses=1] %tmp.1.i = icmp eq i32 %tmp.0.i, 123 ; <i1> [#uses=1]
%tmp.1.i = seteq int %tmp.0.i, 123 ; <bool> [#uses=1] br i1 %tmp.1.i, label %Out.i, label %endif.0.i
br bool %tmp.1.i, label %Out.i, label %endif.0.i
endif.0.i: ; preds = %loopentry.i endif.0.i: ; preds = %loopentry.i
%tmp.3.i = load int* %G ; <int> [#uses=1] %tmp.3.i = load i32* @G ; <i32> [#uses=1]
%tmp.4.i = seteq int %tmp.3.i, 126 ; <bool> [#uses=1] %tmp.4.i = icmp eq i32 %tmp.3.i, 126 ; <i1> [#uses=1]
br bool %tmp.4.i, label %ExitBlock.i, label %endif.1.i br i1 %tmp.4.i, label %ExitBlock.i, label %endif.1.i
endif.1.i: ; preds = %endif.0.i endif.1.i: ; preds = %endif.0.i
%tmp.6.i = load int* %G ; <int> [#uses=1] %tmp.6.i = load i32* @G ; <i32> [#uses=1]
%inc.i = add int %tmp.6.i, 1 ; <int> [#uses=1] %inc.i = add i32 %tmp.6.i, 1 ; <i32> [#uses=1]
store int %inc.i, int* %G store i32 %inc.i, i32* @G
br label %loopentry.i br label %loopentry.i
Out.i: ; preds = %loopentry.i Out.i: ; preds = %loopentry.i
store int 0, int* %G store i32 0, i32* @G
br label %ExitBlock.i br label %ExitBlock.i
ExitBlock.i: ; preds = %Out.i, %endif.0.i
ExitBlock.i: ; preds = %endif.0.i, %Out.i %tmp.7.i = load i32* @G ; <i32> [#uses=1]
%tmp.7.i = load int* %G ; <int> [#uses=1] ret i32 %tmp.7.i
ret int %tmp.7.i
} }

Some files were not shown because too many files have changed in this diff Show More