1; RUN: opt < %s -instcombine -S | FileCheck %s 2 3define void @matching_phi(i64 %a, float* %b, i1 %cond) { 4; CHECK-LABEL: @matching_phi 5entry: 6 %cmp1 = icmp eq i1 %cond, 0 7 %add.int = add i64 %a, 1 8 %add = inttoptr i64 %add.int to float * 9 10 %addb = getelementptr inbounds float, float* %b, i64 2 11 %addb.int = ptrtoint float* %addb to i64 12 br i1 %cmp1, label %A, label %B 13A: 14 br label %C 15B: 16 store float 1.0e+01, float* %add, align 4 17 br label %C 18 19C: 20 %a.addr.03 = phi float* [ %addb, %A ], [ %add, %B ] 21 %b.addr.02 = phi i64 [ %addb.int, %A ], [ %add.int, %B ] 22 %tmp = inttoptr i64 %b.addr.02 to float* 23; CHECK: %a.addr.03 = phi 24; CHECK-NEXT: = load 25 %tmp1 = load float, float* %tmp, align 4 26 %mul.i = fmul float %tmp1, 4.200000e+01 27 store float %mul.i, float* %a.addr.03, align 4 28 ret void 29} 30 31define void @no_matching_phi(i64 %a, float* %b, i1 %cond) { 32; CHECK-LABEL: @no_matching_phi 33entry: 34 %cmp1 = icmp eq i1 %cond, 0 35 %add.int = add i64 %a, 1 36 %add = inttoptr i64 %add.int to float * 37 38 %addb = getelementptr inbounds float, float* %b, i64 2 39 %addb.int = ptrtoint float* %addb to i64 40 br i1 %cmp1, label %A, label %B 41A: 42 br label %C 43B: 44 store float 1.0e+01, float* %add, align 4 45 br label %C 46 47C: 48 %a.addr.03 = phi float* [ %addb, %A ], [ %add, %B ] 49 %b.addr.02 = phi i64 [ %addb.int, %B ], [ %add.int, %A ] 50 %tmp = inttoptr i64 %b.addr.02 to float* 51 %tmp1 = load float, float* %tmp, align 4 52; CHECK: %a.addr.03 = phi 53; CHECK-NEXT: %b.addr.02.ptr = phi 54; CHECK-NEXT: = load 55 %mul.i = fmul float %tmp1, 4.200000e+01 56 store float %mul.i, float* %a.addr.03, align 4 57 ret void 58} 59