+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
define void @test(float* %a, float* readnone %a_end, i64 %b, float* %bf) unnamed_addr {
+; CHECK-LABEL: @test(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CMP1:%.*]] = icmp ult float* [[A:%.*]], [[A_END:%.*]]
+; CHECK-NEXT: [[B_FLOAT:%.*]] = inttoptr i64 [[B:%.*]] to float*
+; CHECK-NEXT: br i1 [[CMP1]], label [[BB1:%.*]], label [[BB2:%.*]]
+; CHECK: bb1:
+; CHECK-NEXT: br label [[FOR_BODY_PREHEADER:%.*]]
+; CHECK: bb2:
+; CHECK-NEXT: [[BFI:%.*]] = ptrtoint float* [[BF:%.*]] to i64
+; CHECK-NEXT: br label [[FOR_BODY_PREHEADER]]
+; CHECK: for.body.preheader:
+; CHECK-NEXT: [[B_PHI:%.*]] = phi i64 [ [[B]], [[BB1]] ], [ [[BFI]], [[BB2]] ]
+; CHECK-NEXT: [[B_PHI_PTR:%.*]] = inttoptr i64 [[B_PHI]] to float*
+; CHECK-NEXT: br label [[FOR_BODY:%.*]]
+; CHECK: for.body:
+; CHECK-NEXT: [[A_ADDR_03:%.*]] = phi float* [ [[INCDEC_PTR:%.*]], [[FOR_BODY]] ], [ [[A]], [[FOR_BODY_PREHEADER]] ]
+; CHECK-NEXT: [[B_ADDR_FLOAT:%.*]] = phi float* [ [[B_ADDR_FLOAT_INC:%.*]], [[FOR_BODY]] ], [ [[B_FLOAT]], [[FOR_BODY_PREHEADER]] ]
+; CHECK-NEXT: [[B_ADDR_I64_PTR:%.*]] = phi float* [ [[B_ADDR_FLOAT_INC]], [[FOR_BODY]] ], [ [[B_PHI_PTR]], [[FOR_BODY_PREHEADER]] ]
+; CHECK-NEXT: [[L:%.*]] = load float, float* [[B_ADDR_FLOAT]], align 4
+; CHECK-NEXT: [[MUL_I:%.*]] = fmul float [[L]], 4.200000e+01
+; CHECK-NEXT: store float [[MUL_I]], float* [[A_ADDR_03]], align 4
+; CHECK-NEXT: [[B_ADDR_FLOAT_INC]] = getelementptr inbounds float, float* [[B_ADDR_I64_PTR]], i64 1
+; CHECK-NEXT: [[INCDEC_PTR]] = getelementptr inbounds float, float* [[A_ADDR_03]], i64 1
+; CHECK-NEXT: [[CMP:%.*]] = icmp ult float* [[INCDEC_PTR]], [[A_END]]
+; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END:%.*]]
+; CHECK: for.end:
+; CHECK-NEXT: ret void
+;
entry:
%cmp1 = icmp ult float* %a, %a_end
%b.float = inttoptr i64 %b to float*
br i1 %cmp1, label %bb1, label %bb2
bb1:
- br label %for.body.preheader
+ br label %for.body.preheader
bb2:
- %bfi = ptrtoint float* %bf to i64
- br label %for.body.preheader
+ %bfi = ptrtoint float* %bf to i64
+ br label %for.body.preheader
for.body.preheader: ; preds = %entry
%b.phi = phi i64 [%b, %bb1], [%bfi, %bb2]
br label %for.body
-; CHECK: for.body.preheader
-; CHECK: %b.phi = phi
-; CHECK: %b.phi.ptr =
-; CHECK: br label %for.body
for.body: ; preds = %for.body.preheader, %for.body
-; CHECK: for.body
%a.addr.03 = phi float* [ %incdec.ptr, %for.body ], [ %a, %for.body.preheader ]
%b.addr.float = phi float* [ %b.addr.float.inc, %for.body ], [ %b.float, %for.body.preheader ]
%b.addr.i64 = phi i64 [ %b.addr.i64.inc, %for.body ], [ %b.phi, %for.body.preheader ]
-; CHECK: %a.addr.03 = phi float* [ %incdec.ptr, %for.body ], [ %a, %for.body.preheader ]
-; CHECK-NEXT: %b.addr.float = phi float* [ %b.addr.float.inc, %for.body ], [ %b.float, %for.body.preheader ]
-; CHECK-NEXT: %b.addr.i64.ptr = phi
-; CHECK-NOT: = phi i64
-; CHECK: = load
- %l = load float, float* %b.addr.float, align 4
+ %l = load float, float* %b.addr.float, align 4
%mul.i = fmul float %l, 4.200000e+01
store float %mul.i, float* %a.addr.03, align 4
%b.addr.float.2 = inttoptr i64 %b.addr.i64 to float*
%b.addr.float.inc = getelementptr inbounds float, float* %b.addr.float.2, i64 1
-; CHECK: store float %mul.i
-; CHECK-NOT: inttoptr
-; CHECK: %b.addr.float.inc =
%b.addr.i64.inc = ptrtoint float* %b.addr.float.inc to i64
-; CHECK-NOT: ptrtoint
%incdec.ptr = getelementptr inbounds float, float* %a.addr.03, i64 1
-; CHECK: %incdec.ptr =
%cmp = icmp ult float* %incdec.ptr, %a_end
br i1 %cmp, label %for.body, label %for.end
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt < %s -passes=instcombine -S | FileCheck %s
define void @test(float* %a, float* readnone %a_end, i64 %b, float* %bf) unnamed_addr {
+; CHECK-LABEL: @test(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[CMP1:%.*]] = icmp ult float* [[A:%.*]], [[A_END:%.*]]
+; CHECK-NEXT: [[B_FLOAT:%.*]] = inttoptr i64 [[B:%.*]] to float*
+; CHECK-NEXT: br i1 [[CMP1]], label [[BB1:%.*]], label [[BB2:%.*]]
+; CHECK: bb1:
+; CHECK-NEXT: br label [[FOR_BODY_PREHEADER:%.*]]
+; CHECK: bb2:
+; CHECK-NEXT: [[BFI:%.*]] = ptrtoint float* [[BF:%.*]] to i64
+; CHECK-NEXT: br label [[FOR_BODY_PREHEADER]]
+; CHECK: for.body.preheader:
+; CHECK-NEXT: [[B_PHI:%.*]] = phi i64 [ [[B]], [[BB1]] ], [ [[BFI]], [[BB2]] ]
+; CHECK-NEXT: [[B_PHI_PTR:%.*]] = inttoptr i64 [[B_PHI]] to float*
+; CHECK-NEXT: switch i64 [[B]], label [[FOR_BODY:%.*]] [
+; CHECK-NEXT: i64 1, label [[FOR_BODY]]
+; CHECK-NEXT: ]
+; CHECK: for.body:
+; CHECK-NEXT: [[A_ADDR_03:%.*]] = phi float* [ [[INCDEC_PTR:%.*]], [[FOR_BODY]] ], [ [[A]], [[FOR_BODY_PREHEADER]] ], [ [[A]], [[FOR_BODY_PREHEADER]] ]
+; CHECK-NEXT: [[B_ADDR_FLOAT:%.*]] = phi float* [ [[B_ADDR_FLOAT_INC:%.*]], [[FOR_BODY]] ], [ [[B_FLOAT]], [[FOR_BODY_PREHEADER]] ], [ [[B_FLOAT]], [[FOR_BODY_PREHEADER]] ]
+; CHECK-NEXT: [[B_ADDR_I64_PTR:%.*]] = phi float* [ [[B_ADDR_FLOAT_INC]], [[FOR_BODY]] ], [ [[B_PHI_PTR]], [[FOR_BODY_PREHEADER]] ], [ [[B_PHI_PTR]], [[FOR_BODY_PREHEADER]] ]
+; CHECK-NEXT: [[L:%.*]] = load float, float* [[B_ADDR_FLOAT]], align 4
+; CHECK-NEXT: [[MUL_I:%.*]] = fmul float [[L]], 4.200000e+01
+; CHECK-NEXT: store float [[MUL_I]], float* [[A_ADDR_03]], align 4
+; CHECK-NEXT: [[B_ADDR_FLOAT_INC]] = getelementptr inbounds float, float* [[B_ADDR_I64_PTR]], i64 1
+; CHECK-NEXT: [[INCDEC_PTR]] = getelementptr inbounds float, float* [[A_ADDR_03]], i64 1
+; CHECK-NEXT: [[CMP:%.*]] = icmp ult float* [[INCDEC_PTR]], [[A_END]]
+; CHECK-NEXT: br i1 [[CMP]], label [[FOR_BODY]], label [[FOR_END:%.*]]
+; CHECK: for.end:
+; CHECK-NEXT: ret void
+;
entry:
%cmp1 = icmp ult float* %a, %a_end
%b.float = inttoptr i64 %b to float*
br i1 %cmp1, label %bb1, label %bb2
bb1:
- br label %for.body.preheader
+ br label %for.body.preheader
bb2:
- %bfi = ptrtoint float* %bf to i64
- br label %for.body.preheader
+ %bfi = ptrtoint float* %bf to i64
+ br label %for.body.preheader
for.body.preheader: ; preds = %entry
%b.phi = phi i64 [%b, %bb1], [%bfi, %bb2]
switch i64 %b, label %for.body [
- i64 1, label %for.body
+ i64 1, label %for.body
]
-; CHECK: for.body.preheader
-; CHECK: %b.phi = phi
-; CHECK: %b.phi.ptr =
-; CHECK-NOT: %b.phi.ptr2 =
-; CHECK: switch
for.body: ; preds = %for.body.preheader, %for.body
-; CHECK: for.body
%a.addr.03 = phi float* [ %incdec.ptr, %for.body ], [ %a, %for.body.preheader ], [%a, %for.body.preheader]
%b.addr.float = phi float* [ %b.addr.float.inc, %for.body ], [ %b.float, %for.body.preheader ], [%b.float, %for.body.preheader]
%b.addr.i64 = phi i64 [ %b.addr.i64.inc, %for.body ], [ %b.phi, %for.body.preheader ], [ %b.phi, %for.body.preheader]
-; CHECK: %a.addr.03 = phi float* [ %incdec.ptr, %for.body ], [ %a, %for.body.preheader ]
-; CHECK-NEXT: %b.addr.float = phi float* [ %b.addr.float.inc, %for.body ], [ %b.float, %for.body.preheader ]
-; CHECK-NEXT: %b.addr.i64.ptr = phi
-; CHECK-NOT: = %b.addr.i64
-; CHECK: = load
- %l = load float, float* %b.addr.float, align 4
+ %l = load float, float* %b.addr.float, align 4
%mul.i = fmul float %l, 4.200000e+01
store float %mul.i, float* %a.addr.03, align 4
%b.addr.float.2 = inttoptr i64 %b.addr.i64 to float*
%b.addr.float.inc = getelementptr inbounds float, float* %b.addr.float.2, i64 1
-; CHECK: store float %mul.i
-; CHECK-NOT: inttoptr
-; CHECK: %b.addr.float.inc =
%b.addr.i64.inc = ptrtoint float* %b.addr.float.inc to i64
-; CHECK-NOT: ptrtoint
%incdec.ptr = getelementptr inbounds float, float* %a.addr.03, i64 1
-; CHECK: %incdec.ptr =
%cmp = icmp ult float* %incdec.ptr, %a_end
br i1 %cmp, label %for.body, label %for.end