manually upgrade a bunch of tests to modern syntax, and remove some that

are either unreduced or only test old syntax.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133228 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner
2011-06-17 03:14:27 +00:00
parent cd4e0b593d
commit 26b0000166
130 changed files with 262 additions and 5810 deletions

View File

@@ -1,20 +0,0 @@
; RUN: opt < %s -loop-extract -disable-output
%struct.node_t = type { double*, %struct.node_t*, %struct.node_t**, double**, double*, i32, i32 }
%struct.table_t = type { [1 x %struct.node_t**], [1 x %struct.node_t**] }
define void @make_tables() {
entry:
%tmp.0.i = malloc %struct.node_t ; <%struct.node_t*> [#uses=1]
br i1 false, label %no_exit.i, label %loopexit.i
no_exit.i: ; preds = %no_exit.i, %entry
%prev_node.0.i.1 = phi %struct.node_t* [ %tmp.16.i, %no_exit.i ], [ %tmp.0.i, %entry ] ; <%struct.node_t*> [#uses=0]
%tmp.16.i = malloc %struct.node_t ; <%struct.node_t*> [#uses=2]
br i1 false, label %no_exit.i, label %loopexit.i
loopexit.i: ; preds = %no_exit.i, %entry
%cur_node.0.i.0 = phi %struct.node_t* [ null, %entry ], [ %tmp.16.i, %no_exit.i ] ; <%struct.node_t*> [#uses=0]
ret void
}

View File

@@ -9,12 +9,12 @@
@g = global i8 0
define internal i8 @foo(i8* inreg %p, i8 signext %y, ... ) zeroext nounwind {
define internal zeroext i8 @foo(i8* inreg %p, i8 signext %y, ... ) nounwind {
store i8 %y, i8* @g
ret i8 0
}
define i32 @bar() {
%A = call i8(i8*, i8, ...)* @foo(i8* inreg null, i8 signext 1, %struct* byval null ) zeroext nounwind
%A = call zeroext i8(i8*, i8, ...)* @foo(i8* inreg null, i8 signext 1, %struct* byval null ) nounwind
ret i32 0
}

View File

@@ -9,7 +9,8 @@ target datalayout = "e-p:64:64:64"
define void @test(i32* %Q, i32* %P) {
%DEAD = load i32* %Q ; <i32> [#uses=1]
store i32 %DEAD, i32* %P
free i32* %P
%1 = bitcast i32* %P to i8*
tail call void @free(i8* %1)
ret void
}
@@ -20,7 +21,8 @@ define void @test(i32* %Q, i32* %P) {
define void @test2({i32, i32}* %P) {
%Q = getelementptr {i32, i32} *%P, i32 0, i32 1
store i32 4, i32* %Q
free {i32,i32}* %P
%1 = bitcast {i32, i32}* %P to i8*
tail call void @free(i8* %1)
ret void
}

View File

@@ -1,7 +0,0 @@
; RUN: opt < %s -functionattrs -S | not grep read
; PR3754
define i8* @m(i32 %size) {
%tmp = malloc i8, i32 %size ; <i8*> [#uses=1]
ret i8* %tmp
}

View File

@@ -6,7 +6,7 @@ target triple = "thumb-apple-darwin8"
@"L_OBJC_IMAGE_INFO" = internal global [2 x i32] zeroinitializer ; <[2 x i32]*> [#uses=1]
@llvm.used = appending global [1 x i8*] [ i8* bitcast ([2 x i32]* @"L_OBJC_IMAGE_INFO" to i8*) ] ; <[1 x i8*]*> [#uses=0]
define i16 @__NSCharToUnicharCFWrapper(i8 zeroext %ch) zeroext {
define zeroext i16 @__NSCharToUnicharCFWrapper(i8 zeroext %ch) {
entry:
%iftmp.0.0.in.in = select i1 false, i16* @replacementUnichar, i16* null ; <i16*> [#uses=1]
%iftmp.0.0.in = load i16* %iftmp.0.0.in.in ; <i16> [#uses=1]

View File

@@ -6,12 +6,16 @@ target triple = "i386-apple-darwin7"
define void @bar(i32 %Size) nounwind noinline {
entry:
%tmp = malloc [1000000 x %struct.foo] ; <[1000000 x %struct.foo]*> [#uses=1]
%malloccall = tail call i8* @malloc(i32 trunc (i64 mul (i64 ptrtoint (i32* getelementptr (i32* null, i32 1) to i64), i64 2000000) to i32))
%tmp = bitcast i8* %malloccall to [1000000 x %struct.foo]*
%.sub = getelementptr [1000000 x %struct.foo]* %tmp, i32 0, i32 0 ; <%struct.foo*> [#uses=1]
store %struct.foo* %.sub, %struct.foo** @X, align 4
ret void
}
declare noalias i8* @malloc(i32)
define i32 @baz() nounwind readonly noinline {
bb1.thread:
%tmpLD1 = load %struct.foo** @X, align 4 ; <%struct.foo*> [#uses=2]

View File

@@ -6,12 +6,15 @@ target triple = "i386-apple-darwin7"
define void @bar(i32 %Size) nounwind noinline {
entry:
%tmp = malloc [1000000 x %struct.foo] ; <[1000000 x %struct.foo]*> [#uses=1]
%malloccall = tail call i8* @malloc(i32 trunc (i64 mul (i64 ptrtoint (i32* getelementptr (i32* null, i32 1) to i64), i64 2000000) to i32))
%tmp = bitcast i8* %malloccall to [1000000 x %struct.foo]*
%.sub = getelementptr [1000000 x %struct.foo]* %tmp, i32 0, i32 0 ; <%struct.foo*> [#uses=1]
store %struct.foo* %.sub, %struct.foo** @X, align 4
ret void
}
declare noalias i8* @malloc(i32)
define i32 @baz() nounwind readonly noinline {
bb1.thread:
%tmpLD1 = load %struct.foo** @X, align 4 ; <%struct.foo*> [#uses=3]

View File

@@ -16,7 +16,7 @@
%struct.YUVGeneralParams = type { i16*, i8*, i8*, i8*, i8*, i8*, void (i8*, i16**, i32, %struct.YUVGeneralParams*)*, i16, i16, i16, [6 x i8], void (i8*, i16**, i32, %struct.YUVGeneralParams*)*, i16, i16 }
@llvm.used = appending global [1 x i8*] [ i8* bitcast (i16 (%struct.JPEGGlobals*)* @ExtractBufferedBlocksIgnored to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0]
define i16 @ExtractBufferedBlocksIgnored(%struct.JPEGGlobals* %globp) signext nounwind {
define signext i16 @ExtractBufferedBlocksIgnored(%struct.JPEGGlobals* %globp) nounwind {
entry:
%tmp4311 = getelementptr %struct.JPEGGlobals* %globp, i32 0, i32 70 ; <i32*> [#uses=1]
%tmp4412 = load i32* %tmp4311, align 16 ; <i32> [#uses=2]

View File

@@ -1,19 +0,0 @@
; In the presence of a negative offset (the -8 below), a fold of a bitcast into
; a malloc messes up the element count, causing an extra 4GB to be allocated on
; 64-bit targets.
;
; RUN: opt < %s -instcombine -S | not grep {= add }
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64"
target triple = "x86_64-unknown-freebsd6.2"
define i1 @test(i32 %tmp141, double** %tmp145)
{
%tmp133 = add i32 %tmp141, 1
%tmp134 = shl i32 %tmp133, 3
%tmp135 = add i32 %tmp134, -8
%tmp136 = malloc i8, i32 %tmp135
%tmp137 = bitcast i8* %tmp136 to double*
store double* %tmp137, double** %tmp145
ret i1 false
}

View File

@@ -3,7 +3,7 @@
define void @blah(i16* %tmp10) {
entry:
call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend_stret to void (i16* sret )*)( i16* %tmp10 sret )
call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend_stret to void (i16* sret )*)( i16* sret %tmp10 )
ret void
}

View File

@@ -5,7 +5,7 @@
define i32 @main(i32 %argc, i8** %argv) {
entry:
%tmp32 = tail call i32 (i8* noalias , ...) nounwind * bitcast (i32 (i8*, ...) nounwind * @printf to i32 (i8* noalias , ...) nounwind *)( i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0) noalias , i32 0 ) nounwind ; <i32> [#uses=0]
%tmp32 = tail call i32 (i8* noalias , ...) * bitcast (i32 (i8*, ...) nounwind * @printf to i32 (i8* noalias , ...) nounwind *)( i8* getelementptr ([4 x i8]* @.str, i32 0, i32 0) , i32 0 ) nounwind ; <i32> [#uses=0]
ret i32 undef
}

View File

@@ -5,7 +5,7 @@ define void @a() {
ret void
}
define i32 @b(i32* inreg %x) signext {
define signext i32 @b(i32* inreg %x) {
ret i32 0
}

View File

@@ -1,6 +1,6 @@
; RUN: opt < %s -instcombine -S | grep bitcast | count 2
define i32 @b(i32* inreg %x) signext {
define signext i32 @b(i32* inreg %x) {
ret i32 0
}

View File

@@ -99,14 +99,6 @@ define void @test11(i32* %P) {
; CHECK: ret void
}
define i32* @test12() {
%p = malloc [4 x i8] ; <[4 x i8]*> [#uses=1]
%c = bitcast [4 x i8]* %p to i32* ; <i32*> [#uses=1]
ret i32* %c
; CHECK: %malloccall = tail call i8* @malloc(i32 4)
; CHECK: 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
@@ -270,17 +262,6 @@ define i1 @test31(i64 %A) {
; CHECK: ret i1 %D
}
define void @test32(double** %tmp) {
%tmp8 = malloc [16 x i8] ; <[16 x i8]*> [#uses=1]
%tmp8.upgrd.1 = bitcast [16 x i8]* %tmp8 to double* ; <double*> [#uses=1]
store double* %tmp8.upgrd.1, double** %tmp
ret void
; CHECK: %malloccall = tail call i8* @malloc(i32 16)
; CHECK: %tmp8.upgrd.1 = bitcast i8* %malloccall to double*
; CHECK: store double* %tmp8.upgrd.1, double** %tmp
; CHECK: ret void
}
define i32 @test33(i32 %c1) {
%x = bitcast i32 %c1 to float ; <float> [#uses=1]
%y = bitcast float %x to i32 ; <i32> [#uses=1]

View File

@@ -52,14 +52,6 @@ define void @test5(i8 %B) {
; CHECK: store i8 %B, i8* getelementptr inbounds ([10 x i8]* @Global, i64 0, i64 4)
}
define i32* @test6() {
%M = malloc [4 x i32]
%A = getelementptr [4 x i32]* %M, i64 0, i64 0
%B = getelementptr i32* %A, i64 2
ret i32* %B
; CHECK: @test6
; CHECK: getelementptr i8* %malloccall, i64 8
}
define i32* @test7(i32* %I, i64 %C, i64 %D) {
%A = getelementptr i32* %I, i64 %C

View File

@@ -1,14 +1,14 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
; PR1201
define i32 @main(i32 %argc, i8** %argv) {
%c_19 = alloca i8*
%malloc_206 = malloc i8, i32 10
%c_19 = alloca i8*
%malloc_206 = tail call i8* @malloc(i32 mul (i32 ptrtoint (i8* getelementptr (i8* null, i32 1) to i32), i32 10))
store i8* %malloc_206, i8** %c_19
%tmp_207 = load i8** %c_19
tail call void @free(i8* %tmp_207)
ret i32 0
; CHECK-NOT: malloc
store i8* %malloc_206, i8** %c_19
%tmp_207 = load i8** %c_19
free i8* %tmp_207
; CHECK-NOT: free
ret i32 0
; CHECK: ret i32 0
}

View File

@@ -1,7 +0,0 @@
; test that malloc's with a constant argument are promoted to array allocations
; RUN: opt < %s -instcombine -S | grep getelementptr
define i32* @test() {
%X = malloc i32, i32 4
ret i32* %X
}

View File

@@ -1,22 +0,0 @@
; RUN: opt < %s -instcombine -S | FileCheck %s
; PR1313
define i32 @test1(i32 %argc, i8* %argv, i8* %envp) {
%tmp15.i.i.i23 = malloc [2564 x i32] ; <[2564 x i32]*> [#uses=1]
; CHECK-NOT: call i8* @malloc
%c = icmp eq [2564 x i32]* %tmp15.i.i.i23, null ; <i1>:0 [#uses=1]
%retval = zext i1 %c to i32 ; <i32> [#uses=1]
ret i32 %retval
; CHECK: ret i32 0
}
define i32 @test2(i32 %argc, i8* %argv, i8* %envp) {
%tmp15.i.i.i23 = malloc [2564 x i32] ; <[2564 x i32]*> [#uses=1]
; CHECK-NOT: call i8* @malloc
%X = bitcast [2564 x i32]* %tmp15.i.i.i23 to i32*
%c = icmp ne i32* %X, null
%retval = zext i1 %c to i32 ; <i32> [#uses=1]
ret i32 %retval
; CHECK: ret i32 1
}

View File

@@ -1,26 +0,0 @@
; RUN: opt < %s -instcombine -S | not grep load
; PR1728
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i686-apple-darwin8"
%struct.foo = type { %struct.foo*, [10 x i32] }
@.str = internal constant [21 x i8] c"tmp = %p, next = %p\0A\00" ; <[21 x i8]*> [#uses=1]
define i32 @main() {
entry:
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
%tmp1 = malloc i8, i32 44 ; <i8*> [#uses=1]
%tmp12 = bitcast i8* %tmp1 to %struct.foo* ; <%struct.foo*> [#uses=3]
%tmp3 = malloc i8, i32 44 ; <i8*> [#uses=1]
%tmp34 = bitcast i8* %tmp3 to %struct.foo* ; <%struct.foo*> [#uses=1]
%tmp6 = getelementptr %struct.foo* %tmp12, i32 0, i32 0 ; <%struct.foo**> [#uses=1]
store %struct.foo* %tmp34, %struct.foo** %tmp6, align 4
%tmp8 = getelementptr %struct.foo* %tmp12, i32 0, i32 0 ; <%struct.foo**> [#uses=1]
%tmp9 = load %struct.foo** %tmp8, align 4 ; <%struct.foo*> [#uses=1]
%tmp10 = getelementptr [21 x i8]* @.str, i32 0, i32 0 ; <i8*> [#uses=1]
%tmp13 = call i32 (i8*, ...)* @printf( i8* %tmp10, %struct.foo* %tmp12, %struct.foo* %tmp9 ) ; <i32> [#uses=0]
ret i32 undef
}
declare i32 @printf(i8*, ...)

View File

@@ -43,7 +43,7 @@ define i32 @test5(i32 %A, i32 %B) {
}
; PR2298
define i8 @test6(i32 %a, i32 %b) zeroext nounwind {
define zeroext i8 @test6(i32 %a, i32 %b) nounwind {
entry:
%tmp1not = xor i32 %a, -1 ; <i32> [#uses=1]
%tmp2not = xor i32 %b, -1 ; <i32> [#uses=1]

View File

@@ -203,7 +203,7 @@ define i1 @test21(i32 %g, i32 %h) {
}
; PR2298
define i1 @test22(i32 %a, i32 %b) zeroext nounwind {
define zeroext i1 @test22(i32 %a, i32 %b) nounwind {
%tmp2 = sub i32 0, %a
%tmp4 = sub i32 0, %b
%tmp5 = icmp eq i32 %tmp2, %tmp4

View File

@@ -4,7 +4,7 @@
%struct.Rock = type { i16, i16 }
@some_idx = internal constant [4 x i8] c"\0A\0B\0E\0F" ; <[4 x i8]*> [#uses=1]
define i8 @t(%struct.FooBar* %up, i8 zeroext %intra_flag, i32 %blk_i) zeroext nounwind {
define zeroext i8 @t(%struct.FooBar* %up, i8 zeroext %intra_flag, i32 %blk_i) nounwind {
entry:
%tmp2 = lshr i32 %blk_i, 1 ; <i32> [#uses=1]
%tmp3 = and i32 %tmp2, 2 ; <i32> [#uses=1]

View File

@@ -1,9 +0,0 @@
; RUN: opt < %s -licm -disable-output
define void @test({ i32 }* %P) {
br label %Loop
Loop: ; preds = %Loop, %0
free { i32 }* %P
br label %Loop
}

View File

@@ -278,7 +278,7 @@ invcont: ; preds = %bb_main
br label %bb_main
invcont.fragment: ; preds = %bb_main
invoke void @_ZN9Fibonacci10get_numberEj( %struct.BigInt* null sret , %struct.Fibonacci* %this_this, i32 %n_i_n_i )
invoke void @_ZN9Fibonacci10get_numberEj( %struct.BigInt* sret null , %struct.Fibonacci* %this_this, i32 %n_i_n_i )
to label %invcont14 unwind label %meshBB37
invcont.unwind10_crit_edge: ; preds = %bb_main
@@ -304,7 +304,7 @@ invcont14: ; preds = %invcont.fragment, %bb_main
br label %bb_main
invcont14.normaldest: ; No predecessors!
invoke %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* @___ZN9__gnu_cxx17__normal_iteratorIP6BigIntSt6vectorIS1_SaIS1_EEEppEv___ZNSt6vectorImSaImEED1Ev___ZN6BigIntD1Ev___ZN9__gnu_cxx13new_allocatorI6BigIntE7destroyEPS1____ZSt8_DestroyIP6BigIntSaIS0_EEvT_S3_T0_( i32 14, %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* null, %"struct.std::vector<ulong,std::allocator<ulong> >"* null, %struct.BigInt* null, %struct.__false_type* null, %struct.BigInt* null, %struct.__false_type* null noalias )
invoke %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* @___ZN9__gnu_cxx17__normal_iteratorIP6BigIntSt6vectorIS1_SaIS1_EEEppEv___ZNSt6vectorImSaImEED1Ev___ZN6BigIntD1Ev___ZN9__gnu_cxx13new_allocatorI6BigIntE7destroyEPS1____ZSt8_DestroyIP6BigIntSaIS0_EEvT_S3_T0_( i32 14, %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* null, %"struct.std::vector<ulong,std::allocator<ulong> >"* null, %struct.BigInt* null, %struct.__false_type* null, %struct.BigInt* null, %struct.__false_type* noalias null )
to label %invcont15 unwind label %meshBB345 ; <%"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"*>:0 [#uses=0]
invcont14.unwind10_crit_edge: ; preds = %bb_main
@@ -372,7 +372,7 @@ invcont.cond_next_crit_edge: ; preds = %bb_main
br label %bb_main
cond_true: ; preds = %bb_main
invoke void @_ZN9Fibonacci10get_numberEj( %struct.BigInt* null sret , %struct.Fibonacci* %this_this, i32 %n_i_n_i )
invoke void @_ZN9Fibonacci10get_numberEj( %struct.BigInt* sret null , %struct.Fibonacci* %this_this, i32 %n_i_n_i )
to label %meshBB323 unwind label %cond_true.unwind_crit_edge
cond_true.unwind_crit_edge: ; preds = %cond_true, %bb_main
@@ -385,7 +385,7 @@ invcont12: ; preds = %bb_main
br label %bb_main
invcont12.fragment: ; preds = %bb_main
invoke %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* @___ZN9__gnu_cxx17__normal_iteratorIP6BigIntSt6vectorIS1_SaIS1_EEEppEv___ZNSt6vectorImSaImEED1Ev___ZN6BigIntD1Ev___ZN9__gnu_cxx13new_allocatorI6BigIntE7destroyEPS1____ZSt8_DestroyIP6BigIntSaIS0_EEvT_S3_T0_( i32 14, %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* null, %"struct.std::vector<ulong,std::allocator<ulong> >"* null, %struct.BigInt* null, %struct.__false_type* null, %struct.BigInt* null, %struct.__false_type* null noalias )
invoke %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* @___ZN9__gnu_cxx17__normal_iteratorIP6BigIntSt6vectorIS1_SaIS1_EEEppEv___ZNSt6vectorImSaImEED1Ev___ZN6BigIntD1Ev___ZN9__gnu_cxx13new_allocatorI6BigIntE7destroyEPS1____ZSt8_DestroyIP6BigIntSaIS0_EEvT_S3_T0_( i32 14, %"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"* null, %"struct.std::vector<ulong,std::allocator<ulong> >"* null, %struct.BigInt* null, %struct.__false_type* null, %struct.BigInt* null, %struct.__false_type* noalias null )
to label %meshBB30 unwind label %meshBB337 ; <%"struct.__gnu_cxx::__normal_iterator<BigInt*,std::vector<BigInt, std::allocator<BigInt> > >"*>:1 [#uses=0]
invcont12.unwind_crit_edge: ; preds = %bb_main
@@ -467,7 +467,7 @@ invcont30.unwind_crit_edge.unwinddest: ; No predecessors!
br label %bb_main
invcont33: ; preds = %bb_main
invoke void @_ZNKSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE3strEv( %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >"* null sret , %"struct.std::ostringstream"* null )
invoke void @_ZNKSt19basic_ostringstreamIcSt11char_traitsIcESaIcEE3strEv( %"struct.std::basic_string<char,std::char_traits<char>,std::allocator<char> >"* sret null , %"struct.std::ostringstream"* null )
to label %invcont36 unwind label %invcont33.unwind_crit_edge
invcont33.unwind_crit_edge: ; preds = %invcont33, %bb_main

View File

@@ -11,11 +11,14 @@ entry:
; CHECK: @test1
; CHECK: call void @llvm.memcpy
%call3 = malloc [13 x i8] ; <[13 x i8]*> [#uses=1]
%malloccall = tail call i8* @malloc(i32 trunc (i64 mul nuw (i64 ptrtoint (i8* getelementptr (i8* null, i32 1) to i64), i64 13) to i32))
%call3 = bitcast i8* %malloccall to [13 x i8]*
%call3.sub = getelementptr inbounds [13 x i8]* %call3, i64 0, i64 0 ; <i8*> [#uses=2]
tail call void @llvm.memmove.i64(i8* %call3.sub, i8* %src, i64 13, i32 1)
ret i8* %call3.sub
}
declare noalias i8* @malloc(i32)
define void @test2(i8* %P) nounwind {
entry:

File diff suppressed because it is too large Load Diff

View File

@@ -1,26 +0,0 @@
; edgefailure - This function illustrates how SCCP is not doing it's job. This
; function should be optimized almost completely away: the loop should be
; analyzed to detect that the body executes exactly once, and thus the branch
; can be eliminated and code becomes trivially dead. This is distilled from a
; real benchmark (mst from Olden benchmark, MakeGraph function). When SCCP is
; fixed, this should be eliminated by a single SCCP application.
;
; RUN: opt < %s -sccp -S | not grep loop
define i32* @test() {
bb1:
%A = malloc i32 ; <i32*> [#uses=2]
br label %bb2
bb2: ; preds = %bb2, %bb1
;; Always 0
%i = phi i32 [ %i2, %bb2 ], [ 0, %bb1 ] ; <i32> [#uses=2]
;; Always 1
%i2 = add i32 %i, 1 ; <i32> [#uses=2]
store i32 %i, i32* %A
;; Always false
%loop = icmp sle i32 %i2, 0 ; <i1> [#uses=1]
br i1 %loop, label %bb2, label %bb3
bb3: ; preds = %bb2
ret i32* %A
}

View File

@@ -2,7 +2,7 @@
%struct.S = type { i16 }
define i1 @f(i16 signext %b) zeroext {
define zeroext i1 @f(i16 signext %b) {
entry:
%b_addr = alloca i16 ; <i16*> [#uses=2]
%retval = alloca i32 ; <i32*> [#uses=2]

View File

@@ -245,10 +245,12 @@ entry:
; VLAs.
define void @test12() {
bb4.i:
%0 = malloc [0 x %struct.Item] ; <[0 x %struct.Item]*> [#uses=1]
%malloccall = tail call i8* @malloc(i32 0)
%0 = bitcast i8* %malloccall to [0 x %struct.Item]*
%.sub.i.c.i = getelementptr [0 x %struct.Item]* %0, i32 0, i32 0 ; <%struct.Item*> [#uses=0]
unreachable
}
declare noalias i8* @malloc(i32)
; PR8680
define void @test13() nounwind {