SCEVExpander's InsertCastOfTo knows how to move existing cast
[oota-llvm.git] / test / Transforms / IndVarSimplify / casted-argument.ll
1 ; RUN: llvm-as < %s | opt -indvars -disable-output
2 ; PR4009
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:32:32"
5 target triple = "i386-pc-linux-gnu"
6
7 define void @safe_bcopy(i8* %to) nounwind {
8 entry:
9         %cmp11 = icmp ult i8* %to, null         ; <i1> [#uses=1]
10         br i1 %cmp11, label %loop, label %return
11
12 return:         ; preds = %entry
13         ret void
14
15 loop:           ; preds = %loop, %if.else
16         %pn = phi i8* [ %ge, %loop ], [ null, %entry ]          ; <i8*> [#uses=1]
17         %cp = ptrtoint i8* %to to i32           ; <i32> [#uses=1]
18         %su = sub i32 0, %cp            ; <i32> [#uses=1]
19         %ge = getelementptr i8* %pn, i32 %su            ; <i8*> [#uses=2]
20         tail call void @bcopy(i8* %ge) nounwind
21         br label %loop
22 }
23
24 declare void @bcopy(i8* nocapture) nounwind