• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt < %s  -instcombine -S | FileCheck %s
2
3define  void @test(float* %a, float* readnone %a_end, i64 %b, float* %bf) unnamed_addr  {
4entry:
5  %cmp1 = icmp ult float* %a, %a_end
6  %b.float = inttoptr i64 %b to float*
7  br i1 %cmp1, label %bb1, label %bb2
8
9bb1:
10 br label %for.body.preheader
11bb2:
12 %bfi = ptrtoint float* %bf to i64
13 br label %for.body.preheader
14
15for.body.preheader:                               ; preds = %entry
16  %b.phi = phi i64 [%b, %bb1], [%bfi, %bb2]
17  br label %for.body
18; CHECK: for.body.preheader
19; CHECK: %b.phi = phi
20; CHECK: %b.phi.ptr =
21; CHECK: br label %for.body
22
23for.body:                                         ; preds = %for.body.preheader, %for.body
24; CHECK: for.body
25  %a.addr.03 = phi float* [ %incdec.ptr, %for.body ], [ %a, %for.body.preheader ]
26  %b.addr.float = phi float* [ %b.addr.float.inc, %for.body ], [ %b.float, %for.body.preheader ]
27  %b.addr.i64 = phi i64 [ %b.addr.i64.inc, %for.body ], [ %b.phi, %for.body.preheader ]
28; CHECK: %a.addr.03 = phi float* [ %incdec.ptr, %for.body ], [ %a, %for.body.preheader ]
29; CHECK-NEXT: %b.addr.float = phi float* [ %b.addr.float.inc, %for.body ], [ %b.float, %for.body.preheader ]
30; CHECK-NEXT: %b.addr.i64.ptr = phi
31; CHECK-NOT:  = phi i64
32; CHECK: = load
33  %l = load float, float* %b.addr.float, align 4
34  %mul.i = fmul float %l, 4.200000e+01
35  store float %mul.i, float* %a.addr.03, align 4
36  %b.addr.float.2 = inttoptr i64 %b.addr.i64 to float*
37  %b.addr.float.inc = getelementptr inbounds float, float* %b.addr.float.2, i64 1
38; CHECK: store float %mul.i
39; CHECK-NOT: inttoptr
40; CHECK: %b.addr.float.inc =
41  %b.addr.i64.inc = ptrtoint float* %b.addr.float.inc to i64
42; CHECK-NOT: ptrtoint
43  %incdec.ptr = getelementptr inbounds float, float* %a.addr.03, i64 1
44; CHECK: %incdec.ptr =
45  %cmp = icmp ult float* %incdec.ptr, %a_end
46  br i1 %cmp, label %for.body, label %for.end
47
48for.end:                                          ; preds = %for.body, %entry
49  ret void
50}
51
52
53
54