1 ; RUN: opt < %s -basicaa -gvn -S | grep TestConst | count 2 2 ; RUN: opt < %s -basicaa -gvn -S | grep TestPure | count 3 3 ; RUN: opt < %s -basicaa -gvn -S | grep TestNone | count 4 4 @g = global i32 0 ; <i32*> [#uses=1] 5 6 define i32 @test() { 7 entry: 8 %tmp0 = call i32 @TestConst( i32 5 ) readnone ; <i32> [#uses=1] 9 %tmp1 = call i32 @TestPure( i32 6 ) readonly ; <i32> [#uses=1] 10 %tmp2 = call i32 @TestNone( i32 7 ) ; <i32> [#uses=1] 11 store i32 1, i32* @g 12 %tmp3 = call i32 @TestConst( i32 5 ) readnone ; <i32> [#uses=1] 13 %tmp4 = call i32 @TestConst( i32 5 ) readnone ; <i32> [#uses=1] 14 %tmp5 = call i32 @TestPure( i32 6 ) readonly ; <i32> [#uses=1] 15 %tmp6 = call i32 @TestPure( i32 6 ) readonly ; <i32> [#uses=1] 16 %tmp7 = call i32 @TestNone( i32 7 ) ; <i32> [#uses=1] 17 %tmp8 = call i32 @TestNone( i32 7 ) ; <i32> [#uses=1] 18 %sum0 = add i32 %tmp0, %tmp1 ; <i32> [#uses=1] 19 %sum1 = add i32 %sum0, %tmp2 ; <i32> [#uses=1] 20 %sum2 = add i32 %sum1, %tmp3 ; <i32> [#uses=1] 21 %sum3 = add i32 %sum2, %tmp4 ; <i32> [#uses=1] 22 %sum4 = add i32 %sum3, %tmp5 ; <i32> [#uses=1] 23 %sum5 = add i32 %sum4, %tmp6 ; <i32> [#uses=1] 24 %sum6 = add i32 %sum5, %tmp7 ; <i32> [#uses=1] 25 %sum7 = add i32 %sum6, %tmp8 ; <i32> [#uses=1] 26 ret i32 %sum7 27 } 28 29 declare i32 @TestConst(i32) readnone 30 31 declare i32 @TestPure(i32) readonly 32 33 declare i32 @TestNone(i32) 34