1 ; RUN: opt < %s -instcombine -S | FileCheck %s
3 define void @test(float* %a, float* readnone %a_end, i64 %b, float* %bf) unnamed_addr {
5 %cmp1 = icmp ult float* %a, %a_end
6 %b.float = inttoptr i64 %b to float*
7 br i1 %cmp1, label %bb1, label %bb2
10 br label %for.body.preheader
12 %bfi = ptrtoint float* %bf to i64
13 br label %for.body.preheader
15 for.body.preheader: ; preds = %entry
16 %b.phi = phi i64 [%b, %bb1], [%bfi, %bb2]
17 switch i64 %b, label %for.body [
18 i64 1, label %for.body
20 ; CHECK: for.body.preheader
23 ; CHECK-NOT: %b.phi.ptr2 =
26 for.body: ; preds = %for.body.preheader, %for.body
28 %a.addr.03 = phi float* [ %incdec.ptr, %for.body ], [ %a, %for.body.preheader ], [%a, %for.body.preheader]
29 %b.addr.float = phi float* [ %b.addr.float.inc, %for.body ], [ %b.float, %for.body.preheader ], [%b.float, %for.body.preheader]
30 %b.addr.i64 = phi i64 [ %b.addr.i64.inc, %for.body ], [ %b.phi, %for.body.preheader ], [ %b.phi, %for.body.preheader]
31 ; CHECK: %a.addr.03 = phi float* [ %incdec.ptr, %for.body ], [ %a, %for.body.preheader ]
32 ; CHECK-NEXT: %b.addr.float = phi float* [ %b.addr.float.inc, %for.body ], [ %b.float, %for.body.preheader ]
33 ; CHECK-NEXT: %b.addr.i64.ptr = phi
34 ; CHECK-NOT: = %b.addr.i64
36 %l = load float, float* %b.addr.float, align 4
37 %mul.i = fmul float %l, 4.200000e+01
38 store float %mul.i, float* %a.addr.03, align 4
39 %b.addr.float.2 = inttoptr i64 %b.addr.i64 to float*
40 %b.addr.float.inc = getelementptr inbounds float, float* %b.addr.float.2, i64 1
41 ; CHECK: store float %mul.i
43 ; CHECK: %b.addr.float.inc =
44 %b.addr.i64.inc = ptrtoint float* %b.addr.float.inc to i64
46 %incdec.ptr = getelementptr inbounds float, float* %a.addr.03, i64 1
47 ; CHECK: %incdec.ptr =
48 %cmp = icmp ult float* %incdec.ptr, %a_end
49 br i1 %cmp, label %for.body, label %for.end
51 for.end: ; preds = %for.body, %entry