diff --git a/llvm/test/Transforms/SCCP/phis.ll b/llvm/test/Transforms/SCCP/phis.ll index 21d97c41388aad..83daae0a7c0c8a 100644 --- a/llvm/test/Transforms/SCCP/phis.ll +++ b/llvm/test/Transforms/SCCP/phis.ll @@ -1,9 +1,14 @@ +; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 ; RUN: opt < %s -passes=sccp -S | FileCheck %s define i1 @float.1(i1 %cmp) { -; CHECK-LABEL: define i1 @float.1(i1 %cmp) { - -; CHECK-LABEL: end: +; CHECK-LABEL: define i1 @float.1( +; CHECK-SAME: i1 [[CMP:%.*]]) { +; CHECK-NEXT: [[ENTRY:.*:]] +; CHECK-NEXT: br i1 [[CMP]], label %[[IF_TRUE:.*]], label %[[END:.*]] +; CHECK: [[IF_TRUE]]: +; CHECK-NEXT: br label %[[END]] +; CHECK: [[END]]: ; CHECK-NEXT: ret i1 true ; entry: @@ -19,12 +24,16 @@ end: } define i1 @float.2(i1 %cmp) { -; CHECK-LABEL: define i1 @float.2(i1 %cmp) { - -; CHECK-LABEL: end: -; CHECK-NEXT: %p = phi float [ 1.000000e+00, %entry ], [ 2.000000e+00, %if.true ] -; CHECK-NEXT: %c = fcmp ueq float %p, 1.000000e+00 -; CHECK-NEXT: ret i1 %c +; CHECK-LABEL: define i1 @float.2( +; CHECK-SAME: i1 [[CMP:%.*]]) { +; CHECK-NEXT: [[ENTRY:.*]]: +; CHECK-NEXT: br i1 [[CMP]], label %[[IF_TRUE:.*]], label %[[END:.*]] +; CHECK: [[IF_TRUE]]: +; CHECK-NEXT: br label %[[END]] +; CHECK: [[END]]: +; CHECK-NEXT: [[P:%.*]] = phi float [ 1.000000e+00, %[[ENTRY]] ], [ 2.000000e+00, %[[IF_TRUE]] ] +; CHECK-NEXT: [[C:%.*]] = fcmp ueq float [[P]], 1.000000e+00 +; CHECK-NEXT: ret i1 [[C]] ; entry: br i1 %cmp, label %if.true, label %end @@ -39,13 +48,18 @@ end: } define i1 @float.3(float %f, i1 %cmp) { -; CHECK-LABEL: define i1 @float.3(float %f, i1 %cmp) - -; CHECK-LABEL: end: -; CHECK-NEXT: %p = phi float [ 1.000000e+00, %entry ], [ %f, %if.true ] -; CHECK-NEXT: %c = fcmp ueq float %p, 1.000000e+00 -; CHECK-NEXT: ret i1 %c +; CHECK-LABEL: define i1 @float.3( +; CHECK-SAME: float [[F:%.*]], i1 [[CMP:%.*]]) { +; CHECK-NEXT: [[ENTRY:.*]]: +; CHECK-NEXT: br i1 [[CMP]], label %[[IF_TRUE:.*]], label %[[END:.*]] +; CHECK: [[IF_TRUE]]: +; CHECK-NEXT: br label %[[END]] +; CHECK: [[END]]: +; CHECK-NEXT: [[P:%.*]] = phi float [ 1.000000e+00, %[[ENTRY]] ], [ [[F]], %[[IF_TRUE]] ] +; CHECK-NEXT: [[C:%.*]] = fcmp ueq float [[P]], 1.000000e+00 +; CHECK-NEXT: ret i1 [[C]] ; + entry: br i1 %cmp, label %if.true, label %end @@ -60,11 +74,16 @@ end: define i1 @float.4_unreachable(float %f, i1 %cmp) { -; CHECK-LABEL: define i1 @float.4_unreachable(float %f, i1 %cmp) - -; CHECK-LABEL: end: +; CHECK-LABEL: define i1 @float.4_unreachable( +; CHECK-SAME: float [[F:%.*]], i1 [[CMP:%.*]]) { +; CHECK-NEXT: [[ENTRY:.*:]] +; CHECK-NEXT: br i1 [[CMP]], label %[[IF_TRUE:.*]], label %[[END:.*]] +; CHECK: [[IF_TRUE]]: +; CHECK-NEXT: br label %[[END]] +; CHECK: [[END]]: ; CHECK-NEXT: ret i1 false ; + entry: br i1 %cmp, label %if.true, label %end @@ -79,3 +98,77 @@ end: %c = fcmp une float %p, 1.0 ret i1 %c } + +define <2 x i16> @phi_vector_merge1(i1 %c, <2 x i8> %a) { +; CHECK-LABEL: define <2 x i16> @phi_vector_merge1( +; CHECK-SAME: i1 [[C:%.*]], <2 x i8> [[A:%.*]]) { +; CHECK-NEXT: [[ENTRY:.*]]: +; CHECK-NEXT: [[ZEXT:%.*]] = zext <2 x i8> [[A]] to <2 x i16> +; CHECK-NEXT: br i1 [[C]], label %[[IF:.*]], label %[[JOIN:.*]] +; CHECK: [[IF]]: +; CHECK-NEXT: br label %[[JOIN]] +; CHECK: [[JOIN]]: +; CHECK-NEXT: [[PHI:%.*]] = phi <2 x i16> [ [[ZEXT]], %[[ENTRY]] ], [ , %[[IF]] ] +; CHECK-NEXT: [[ADD:%.*]] = add <2 x i16> [[PHI]], +; CHECK-NEXT: ret <2 x i16> [[ADD]] +; +entry: + %zext = zext <2 x i8> %a to <2 x i16> + br i1 %c, label %if, label %join + +if: + br label %join + +join: + %phi = phi <2 x i16> [ %zext, %entry ], [ , %if ] + %add = add <2 x i16> %phi, + ret <2 x i16> %add +} + +define <2 x i16> @phi_vector_merge2(i1 %c, <2 x i8> %a) { +; CHECK-LABEL: define <2 x i16> @phi_vector_merge2( +; CHECK-SAME: i1 [[C:%.*]], <2 x i8> [[A:%.*]]) { +; CHECK-NEXT: [[ENTRY:.*]]: +; CHECK-NEXT: [[ZEXT:%.*]] = zext <2 x i8> [[A]] to <2 x i16> +; CHECK-NEXT: br i1 [[C]], label %[[IF:.*]], label %[[JOIN:.*]] +; CHECK: [[IF]]: +; CHECK-NEXT: br label %[[JOIN]] +; CHECK: [[JOIN]]: +; CHECK-NEXT: [[PHI:%.*]] = phi <2 x i16> [ , %[[ENTRY]] ], [ [[ZEXT]], %[[IF]] ] +; CHECK-NEXT: [[ADD:%.*]] = add <2 x i16> [[PHI]], +; CHECK-NEXT: ret <2 x i16> [[ADD]] +; +entry: + %zext = zext <2 x i8> %a to <2 x i16> + br i1 %c, label %if, label %join + +if: + br label %join + +join: + %phi = phi <2 x i16> [ , %entry ], [ %zext, %if ] + %add = add <2 x i16> %phi, + ret <2 x i16> %add +} + +define <2 x float> @phi_vector_merge_float(i1 %c) { +; CHECK-LABEL: define <2 x float> @phi_vector_merge_float( +; CHECK-SAME: i1 [[C:%.*]]) { +; CHECK-NEXT: [[ENTRY:.*]]: +; CHECK-NEXT: br i1 [[C]], label %[[IF:.*]], label %[[JOIN:.*]] +; CHECK: [[IF]]: +; CHECK-NEXT: br label %[[JOIN]] +; CHECK: [[JOIN]]: +; CHECK-NEXT: [[PHI:%.*]] = phi <2 x float> [ , %[[ENTRY]] ], [ , %[[IF]] ] +; CHECK-NEXT: ret <2 x float> [[PHI]] +; +entry: + br i1 %c, label %if, label %join + +if: + br label %join + +join: + %phi = phi <2 x float> [ , %entry ], [ , %if ] + ret <2 x float> %phi +}