1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
2 ; RUN: opt < %s -passes=instcombine -S | FileCheck %s
4 define void @test1(ptr %a, ptr readnone %a_end, ptr %b.i) {
5 ; CHECK-LABEL: define void @test1
6 ; CHECK-SAME: (ptr [[A:%.*]], ptr readnone [[A_END:%.*]], ptr [[B_I:%.*]]) {
8 ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult ptr [[A]], [[A_END]]
9 ; CHECK-NEXT: br i1 [[CMP1]], label [[FOR_BODY_PREHEADER:%.*]], label [[FOR_END:%.*]]
10 ; CHECK: for.body.preheader:
11 ; CHECK-NEXT: br label [[FOR_BODY:%.*]]
13 ; CHECK-NEXT: [[A_ADDR_03:%.*]] = phi ptr [ [[INCDEC_PTR:%.*]], [[FOR_BODY]] ], [ [[A]], [[FOR_BODY_PREHEADER]] ]
14 ; CHECK-NEXT: [[B_ADDR_02_IN:%.*]] = phi ptr [ [[ADD:%.*]], [[FOR_BODY]] ], [ [[B_I]], [[FOR_BODY_PREHEADER]] ]
15 ; CHECK-NEXT: [[TMP1:%.*]] = load float, ptr [[B_ADDR_02_IN]], align 4
16 ; CHECK-NEXT: [[MUL_I:%.*]] = fmul float [[TMP1]], 4.200000e+01
17 ; CHECK-NEXT: store float [[MUL_I]], ptr [[A_ADDR_03]], align 4
18 ; CHECK-NEXT: [[ADD]] = getelementptr inbounds i8, ptr [[B_ADDR_02_IN]], i64 4
19 ; CHECK-NEXT: [[INCDEC_PTR]] = getelementptr inbounds i8, ptr [[A_ADDR_03]], i64 4
20 ; CHECK-NEXT: [[CMP:%.*]] = icmp ult ptr [[INCDEC_PTR]], [[A_END]]
21 ; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END]]
23 ; CHECK-NEXT: ret void
26 %cmp1 = icmp ult ptr %a, %a_end
27 br i1 %cmp1, label %for.body.preheader, label %for.end
29 for.body.preheader: ; preds = %entry
30 %b = ptrtoint ptr %b.i to i64
33 for.body: ; preds = %for.body, %for.body.preheader
34 %a.addr.03 = phi ptr [ %incdec.ptr, %for.body ], [ %a, %for.body.preheader ]
35 %b.addr.02 = phi i64 [ %add.int, %for.body ], [ %b, %for.body.preheader ]
36 %tmp = inttoptr i64 %b.addr.02 to ptr
37 %tmp1 = load float, ptr %tmp, align 4
38 %mul.i = fmul float %tmp1, 4.200000e+01
39 store float %mul.i, ptr %a.addr.03, align 4
40 %add = getelementptr inbounds float, ptr %tmp, i64 1
41 %add.int = ptrtoint ptr %add to i64
42 %incdec.ptr = getelementptr inbounds float, ptr %a.addr.03, i64 1
43 %cmp = icmp ult ptr %incdec.ptr, %a_end
44 br i1 %cmp, label %for.body, label %for.end
46 for.end: ; preds = %for.body, %entry