Home | History | Annotate | Download | only in IndVarSimplify
      1 ; RUN: opt < %s -indvars
      2 ; PR4271
      3 
      4 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"
      5 target triple = "i386-apple-darwin10.0"
      6 	%struct.xyz = type <{ i64, i64, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i32, i64, [8 x i8], i64, i64, i32, i32, [4 x i32], i32, i32, i32, i32, i32, i32, [76 x i32], i32, [2 x %struct.uvw] }>
      7 	%struct.uvw = type <{ i64, i64 }>
      8 
      9 define i32 @foo(%struct.xyz* %header, i8* %p2, i8* %p3, i8* nocapture %p4) nounwind {
     10 entry:
     11 	br label %while.body.i
     12 
     13 while.body.i:		; preds = %while.body.i, %entry
     14 	br i1 undef, label %while.body.i, label %bcopy_internal.exit
     15 
     16 bcopy_internal.exit:		; preds = %while.body.i
     17 	%conv135 = ptrtoint %struct.xyz* %header to i32		; <i32> [#uses=1]
     18 	%shr136 = lshr i32 %conv135, 12		; <i32> [#uses=1]
     19 	br label %for.body
     20 
     21 for.body:		; preds = %for.body, %bcopy_internal.exit
     22 	%ppnum.052 = phi i32 [ %inc, %for.body ], [ %shr136, %bcopy_internal.exit ]		; <i32> [#uses=1]
     23 	%inc = add i32 %ppnum.052, 1		; <i32> [#uses=2]
     24 	%cmp = icmp ugt i32 %inc, undef		; <i1> [#uses=1]
     25 	br i1 %cmp, label %if.then199, label %for.body
     26 
     27 if.then199:		; preds = %if.then199, %for.body
     28 	br label %if.then199
     29 }
     30 
     31 define i32 @same_thing_but_signed(%struct.xyz* %header, i8* %p2, i8* %p3, i8* nocapture %p4) nounwind {
     32 entry:
     33 	br label %while.body.i
     34 
     35 while.body.i:		; preds = %while.body.i, %entry
     36 	br i1 undef, label %while.body.i, label %bcopy_internal.exit
     37 
     38 bcopy_internal.exit:		; preds = %while.body.i
     39 	%conv135 = ptrtoint %struct.xyz* %header to i32		; <i32> [#uses=1]
     40 	%shr136 = ashr i32 %conv135, 12		; <i32> [#uses=1]
     41 	br label %for.body
     42 
     43 for.body:		; preds = %for.body, %bcopy_internal.exit
     44 	%ppnum.052 = phi i32 [ %inc, %for.body ], [ %shr136, %bcopy_internal.exit ]		; <i32> [#uses=1]
     45 	%inc = add i32 %ppnum.052, 1		; <i32> [#uses=2]
     46 	%cmp = icmp ugt i32 %inc, undef		; <i1> [#uses=1]
     47 	br i1 %cmp, label %if.then199, label %for.body
     48 
     49 if.then199:		; preds = %if.then199, %for.body
     50 	br label %if.then199
     51 }
     52 
     53 define i32 @same_thing_but_multiplied(%struct.xyz* %header, i8* %p2, i8* %p3, i8* nocapture %p4) nounwind {
     54 entry:
     55 	br label %while.body.i
     56 
     57 while.body.i:		; preds = %while.body.i, %entry
     58 	br i1 undef, label %while.body.i, label %bcopy_internal.exit
     59 
     60 bcopy_internal.exit:		; preds = %while.body.i
     61 	%conv135 = ptrtoint %struct.xyz* %header to i32		; <i32> [#uses=1]
     62 	%shr136 = shl i32 %conv135, 12		; <i32> [#uses=1]
     63 	br label %for.body
     64 
     65 for.body:		; preds = %for.body, %bcopy_internal.exit
     66 	%ppnum.052 = phi i32 [ %inc, %for.body ], [ %shr136, %bcopy_internal.exit ]		; <i32> [#uses=1]
     67 	%inc = add i32 %ppnum.052, 1		; <i32> [#uses=2]
     68 	%cmp = icmp ugt i32 %inc, undef		; <i1> [#uses=1]
     69 	br i1 %cmp, label %if.then199, label %for.body
     70 
     71 if.then199:		; preds = %if.then199, %for.body
     72 	br label %if.then199
     73 }
     74 
     75 define i32 @same_thing_but_xored(%struct.xyz* %header, i8* %p2, i8* %p3, i8* nocapture %p4) nounwind {
     76 entry:
     77 	br label %while.body.i
     78 
     79 while.body.i:		; preds = %while.body.i, %entry
     80 	br i1 undef, label %while.body.i, label %bcopy_internal.exit
     81 
     82 bcopy_internal.exit:		; preds = %while.body.i
     83 	%conv135 = ptrtoint %struct.xyz* %header to i32		; <i32> [#uses=1]
     84 	%shr136 = xor i32 %conv135, 12		; <i32> [#uses=1]
     85 	br label %for.body
     86 
     87 for.body:		; preds = %for.body, %bcopy_internal.exit
     88 	%ppnum.052 = phi i32 [ %inc, %for.body ], [ %shr136, %bcopy_internal.exit ]		; <i32> [#uses=1]
     89 	%inc = add i32 %ppnum.052, 1		; <i32> [#uses=2]
     90 	%cmp = icmp ugt i32 %inc, undef		; <i1> [#uses=1]
     91 	br i1 %cmp, label %if.then199, label %for.body
     92 
     93 if.then199:		; preds = %if.then199, %for.body
     94 	br label %if.then199
     95 }
     96