Make several tests less fragile.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93230 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dan Gohman 2010-01-12 04:52:47 +00:00
parent f1b4d26e67
commit ad4f7a6882
5 changed files with 21 additions and 15 deletions

View File

@ -10,9 +10,8 @@ entry:
cond_true: ; preds = %cond_true, %entry cond_true: ; preds = %cond_true, %entry
%indvar = phi i32 [ 0, %entry ], [ %indvar.next, %cond_true ] ; <i32> [#uses=2] %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %cond_true ] ; <i32> [#uses=2]
%tmp. = shl i32 %indvar, 2 ; <i32> [#uses=1] %tmp. = shl i32 %indvar, 2 ; <i32> [#uses=1]
%tmp.10 = add i32 %tmp., 1 ; <i32> [#uses=2] %tmp.10 = add nsw i32 %tmp., 1 ; <i32> [#uses=2]
%k.0.0 = bitcast i32 %tmp.10 to i32 ; <i32> [#uses=2] %tmp31 = add nsw i32 %tmp.10, -1 ; <i32> [#uses=4]
%tmp31 = add i32 %k.0.0, -1 ; <i32> [#uses=4]
%tmp32 = getelementptr i32* %mpp, i32 %tmp31 ; <i32*> [#uses=1] %tmp32 = getelementptr i32* %mpp, i32 %tmp31 ; <i32*> [#uses=1]
%tmp34 = bitcast i32* %tmp32 to <16 x i8>* ; <i8*> [#uses=1] %tmp34 = bitcast i32* %tmp32 to <16 x i8>* ; <i8*> [#uses=1]
%tmp = load <16 x i8>* %tmp34, align 1 %tmp = load <16 x i8>* %tmp34, align 1
@ -37,14 +36,13 @@ cond_true: ; preds = %cond_true, %entry
%tmp111 = and <2 x i64> %tmp110, %tmp55.upgrd.2 ; <<2 x i64>> [#uses=1] %tmp111 = and <2 x i64> %tmp110, %tmp55.upgrd.2 ; <<2 x i64>> [#uses=1]
%tmp121 = and <2 x i64> %tmp99.upgrd.5, %tmp88.upgrd.4 ; <<2 x i64>> [#uses=1] %tmp121 = and <2 x i64> %tmp99.upgrd.5, %tmp88.upgrd.4 ; <<2 x i64>> [#uses=1]
%tmp131 = or <2 x i64> %tmp121, %tmp111 ; <<2 x i64>> [#uses=1] %tmp131 = or <2 x i64> %tmp121, %tmp111 ; <<2 x i64>> [#uses=1]
%gep.upgrd.6 = zext i32 %tmp.10 to i64 ; <i64> [#uses=1] %tmp137 = getelementptr i32* %mc, i32 %tmp.10 ; <i32*> [#uses=1]
%tmp137 = getelementptr i32* %mc, i64 %gep.upgrd.6 ; <i32*> [#uses=1]
%tmp137.upgrd.7 = bitcast i32* %tmp137 to <2 x i64>* ; <<2 x i64>*> [#uses=1] %tmp137.upgrd.7 = bitcast i32* %tmp137 to <2 x i64>* ; <<2 x i64>*> [#uses=1]
store <2 x i64> %tmp131, <2 x i64>* %tmp137.upgrd.7 store <2 x i64> %tmp131, <2 x i64>* %tmp137.upgrd.7
%tmp147 = add i32 %k.0.0, 8 ; <i32> [#uses=1] %tmp147 = add nsw i32 %tmp.10, 8 ; <i32> [#uses=1]
%tmp.upgrd.8 = icmp sgt i32 %tmp147, %M ; <i1> [#uses=1] %tmp.upgrd.8 = icmp slt i32 %tmp147, %M ; <i1> [#uses=1]
%indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1] %indvar.next = add i32 %indvar, 1 ; <i32> [#uses=1]
br i1 %tmp.upgrd.8, label %return, label %cond_true br i1 %tmp.upgrd.8, label %cond_true, label %return
return: ; preds = %cond_true, %entry return: ; preds = %cond_true, %entry
ret void ret void

View File

@ -4,7 +4,7 @@
@X = common global i16 0 ; <i16*> [#uses=1] @X = common global i16 0 ; <i16*> [#uses=1]
define void @foo(i32 %N) nounwind { define i32 @foo(i32 %N) nounwind {
entry: entry:
%0 = icmp sgt i32 %N, 0 ; <i1> [#uses=1] %0 = icmp sgt i32 %N, 0 ; <i1> [#uses=1]
br i1 %0, label %bb, label %return br i1 %0, label %bb, label %return
@ -18,5 +18,6 @@ bb: ; preds = %bb, %entry
br i1 %exitcond, label %return, label %bb br i1 %exitcond, label %return, label %bb
return: ; preds = %bb, %entry return: ; preds = %bb, %entry
ret void %h = phi i32 [ 0, %entry ], [ %indvar.next, %bb ]
ret i32 %h
} }

View File

@ -7,6 +7,7 @@
@B = external global [1000 x i8], align 32 @B = external global [1000 x i8], align 32
@A = external global [1000 x i8], align 32 @A = external global [1000 x i8], align 32
@P = external global [1000 x i8], align 32 @P = external global [1000 x i8], align 32
@Q = external global [1000 x i8], align 32
define void @foo(i32 %m, i32 %p) nounwind { define void @foo(i32 %m, i32 %p) nounwind {
entry: entry:
@ -24,6 +25,8 @@ bb:
%tmp0 = add i32 %tmp8, %p %tmp0 = add i32 %tmp8, %p
%tmp10 = getelementptr [1000 x i8]* @P, i32 0, i32 %tmp0 %tmp10 = getelementptr [1000 x i8]* @P, i32 0, i32 %tmp0
store i8 17, i8* %tmp10, align 4 store i8 17, i8* %tmp10, align 4
%tmp11 = getelementptr [1000 x i8]* @Q, i32 0, i32 %tmp0
store i8 19, i8* %tmp11, align 4
%indvar.next = add i32 %i.019.0, 1 %indvar.next = add i32 %i.019.0, 1
%exitcond = icmp eq i32 %indvar.next, %m %exitcond = icmp eq i32 %indvar.next, %m
br i1 %exitcond, label %return, label %bb br i1 %exitcond, label %return, label %bb

View File

@ -1,8 +1,12 @@
; RUN: opt < %s -loop-reduce -S \ ; RUN: opt < %s -loop-reduce -S | FileCheck %s
; RUN: | grep {getelementptr.*%lsr.iv.*%lsr.iv.*<i32\\*>}
; The multiply in bb2 must not be reduced to an add, as the sext causes the ; The multiply in bb2 must not be reduced to an add, as the sext causes the
; %1 argument to become negative after a while. ; %1 argument to become negative after a while.
; ModuleID = '<stdin>'
; CHECK: sext i8
; CHECK: mul i32
; CHECK: store i32
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 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 = "i386-apple-darwin9.6" target triple = "i386-apple-darwin9.6"
@table = common global [32 x [256 x i32]] zeroinitializer, align 32 ; <[32 x [256 x i32]]*> [#uses=2] @table = common global [32 x [256 x i32]] zeroinitializer, align 32 ; <[32 x [256 x i32]]*> [#uses=2]

View File

@ -4,14 +4,14 @@
; Don't reverse the iteration if the rhs of the compare is defined ; Don't reverse the iteration if the rhs of the compare is defined
; inside the loop. ; inside the loop.
define void @Fill_Buffer() nounwind { define void @Fill_Buffer(i2* %p) nounwind {
entry: entry:
br label %bb8 br label %bb8
bb8: bb8:
%indvar34 = phi i32 [ 0, %entry ], [ %indvar.next35, %bb8 ] %indvar34 = phi i32 [ 0, %entry ], [ %indvar.next35, %bb8 ]
%indvar3451 = trunc i32 %indvar34 to i2 %indvar3451 = trunc i32 %indvar34 to i2
%xmp4344 = xor i2 0, -1 %xmp4344 = load i2* %p
%xmp104 = icmp eq i2 %indvar3451, %xmp4344 %xmp104 = icmp eq i2 %indvar3451, %xmp4344
%indvar.next35 = add i32 %indvar34, 1 %indvar.next35 = add i32 %indvar34, 1
br i1 %xmp104, label %bb10, label %bb8 br i1 %xmp104, label %bb10, label %bb8