summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-01-06 20:01:02 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-01-06 20:01:02 +0000
commit8a6c1c25bce0267ee4072bd7b786b921e8a66a35 (patch)
treeea70b740d40cffe568a990c7aecd1acb5f83f786 /test/Transforms/InstCombine
parent84fe440ded1bfc237d720c49408b36798d67ceff (diff)
Notes
Diffstat (limited to 'test/Transforms/InstCombine')
-rw-r--r--test/Transforms/InstCombine/double-float-shrink-1.ll253
-rw-r--r--test/Transforms/InstCombine/fast-math.ll33
-rw-r--r--test/Transforms/InstCombine/insert-extract-shuffle.ll53
-rw-r--r--test/Transforms/InstCombine/token.ll17
4 files changed, 227 insertions, 129 deletions
diff --git a/test/Transforms/InstCombine/double-float-shrink-1.ll b/test/Transforms/InstCombine/double-float-shrink-1.ll
index 63a02bbd8572..319ea3259830 100644
--- a/test/Transforms/InstCombine/double-float-shrink-1.ll
+++ b/test/Transforms/InstCombine/double-float-shrink-1.ll
@@ -9,273 +9,286 @@ target triple = "x86_64-unknown-linux-gnu"
; the -enable-double-float-shrink option.
; PR17850: http://llvm.org/bugs/show_bug.cgi?id=17850
-define float @acos_test(float %f) {
+define float @acos_test1(float %f) {
%conv = fpext float %f to double
- %call = call double @acos(double %conv)
+ %call = call fast double @acos(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: acos_test
-; CHECK: call float @acosf(float %f)
+; CHECK-LABEL: acos_test1
+; CHECK: call fast float @acosf(float %f)
}
define double @acos_test2(float %f) {
%conv = fpext float %f to double
- %call = call double @acos(double %conv)
+ %call = call fast double @acos(double %conv)
ret double %call
; CHECK-LABEL: acos_test2
-; CHECK: call double @acos(double %conv)
+; CHECK: call fast double @acos(double %conv)
}
-define float @acosh_test(float %f) {
+define float @acosh_test1(float %f) {
%conv = fpext float %f to double
- %call = call double @acosh(double %conv)
+ %call = call fast double @acosh(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: acosh_test
-; CHECK: call float @acoshf(float %f)
+; CHECK-LABEL: acosh_test1
+; CHECK: call fast float @acoshf(float %f)
}
define double @acosh_test2(float %f) {
%conv = fpext float %f to double
- %call = call double @acosh(double %conv)
+ %call = call fast double @acosh(double %conv)
ret double %call
; CHECK-LABEL: acosh_test2
-; CHECK: call double @acosh(double %conv)
+; CHECK: call fast double @acosh(double %conv)
}
-define float @asin_test(float %f) {
+define float @asin_test1(float %f) {
%conv = fpext float %f to double
- %call = call double @asin(double %conv)
+ %call = call fast double @asin(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: asin_test
-; CHECK: call float @asinf(float %f)
+; CHECK-LABEL: asin_test1
+; CHECK: call fast float @asinf(float %f)
}
define double @asin_test2(float %f) {
%conv = fpext float %f to double
- %call = call double @asin(double %conv)
+ %call = call fast double @asin(double %conv)
ret double %call
; CHECK-LABEL: asin_test2
-; CHECK: call double @asin(double %conv)
+; CHECK: call fast double @asin(double %conv)
}
-define float @asinh_test(float %f) {
+define float @asinh_test1(float %f) {
%conv = fpext float %f to double
- %call = call double @asinh(double %conv)
+ %call = call fast double @asinh(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: asinh_test
-; CHECK: call float @asinhf(float %f)
+; CHECK-LABEL: asinh_test1
+; CHECK: call fast float @asinhf(float %f)
}
define double @asinh_test2(float %f) {
%conv = fpext float %f to double
- %call = call double @asinh(double %conv)
+ %call = call fast double @asinh(double %conv)
ret double %call
; CHECK-LABEL: asinh_test2
-; CHECK: call double @asinh(double %conv)
+; CHECK: call fast double @asinh(double %conv)
}
-define float @atan_test(float %f) {
+define float @atan_test1(float %f) {
%conv = fpext float %f to double
- %call = call double @atan(double %conv)
+ %call = call fast double @atan(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: atan_test
-; CHECK: call float @atanf(float %f)
+; CHECK-LABEL: atan_test1
+; CHECK: call fast float @atanf(float %f)
}
define double @atan_test2(float %f) {
%conv = fpext float %f to double
- %call = call double @atan(double %conv)
+ %call = call fast double @atan(double %conv)
ret double %call
; CHECK-LABEL: atan_test2
-; CHECK: call double @atan(double %conv)
+; CHECK: call fast double @atan(double %conv)
}
-define float @atanh_test(float %f) {
+
+define float @atanh_test1(float %f) {
%conv = fpext float %f to double
- %call = call double @atanh(double %conv)
+ %call = call fast double @atanh(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: atanh_test
-; CHECK: call float @atanhf(float %f)
+; CHECK-LABEL: atanh_test1
+; CHECK: call fast float @atanhf(float %f)
}
define double @atanh_test2(float %f) {
%conv = fpext float %f to double
- %call = call double @atanh(double %conv)
+ %call = call fast double @atanh(double %conv)
ret double %call
; CHECK-LABEL: atanh_test2
-; CHECK: call double @atanh(double %conv)
+; CHECK: call fast double @atanh(double %conv)
}
-define float @cbrt_test(float %f) {
+
+define float @cbrt_test1(float %f) {
%conv = fpext float %f to double
- %call = call double @cbrt(double %conv)
+ %call = call fast double @cbrt(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: cbrt_test
-; CHECK: call float @cbrtf(float %f)
+; CHECK-LABEL: cbrt_test1
+; CHECK: call fast float @cbrtf(float %f)
}
define double @cbrt_test2(float %f) {
%conv = fpext float %f to double
- %call = call double @cbrt(double %conv)
+ %call = call fast double @cbrt(double %conv)
ret double %call
; CHECK-LABEL: cbrt_test2
-; CHECK: call double @cbrt(double %conv)
+; CHECK: call fast double @cbrt(double %conv)
}
-define float @exp_test(float %f) {
+
+define float @exp_test1(float %f) {
%conv = fpext float %f to double
- %call = call double @exp(double %conv)
+ %call = call fast double @exp(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: exp_test
-; CHECK: call float @expf(float %f)
+; CHECK-LABEL: exp_test1
+; CHECK: call fast float @expf(float %f)
}
define double @exp_test2(float %f) {
%conv = fpext float %f to double
- %call = call double @exp(double %conv)
+ %call = call fast double @exp(double %conv)
ret double %call
; CHECK-LABEL: exp_test2
-; CHECK: call double @exp(double %conv)
+; CHECK: call fast double @exp(double %conv)
}
-define float @expm1_test(float %f) {
+
+define float @expm1_test1(float %f) {
%conv = fpext float %f to double
- %call = call double @expm1(double %conv)
+ %call = call fast double @expm1(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: expm1_test
-; CHECK: call float @expm1f(float %f)
+; CHECK-LABEL: expm1_test1
+; CHECK: call fast float @expm1f(float %f)
}
define double @expm1_test2(float %f) {
%conv = fpext float %f to double
- %call = call double @expm1(double %conv)
+ %call = call fast double @expm1(double %conv)
ret double %call
; CHECK-LABEL: expm1_test2
-; CHECK: call double @expm1(double %conv)
+; CHECK: call fast double @expm1(double %conv)
}
-define float @exp10_test(float %f) {
+
+; exp10f() doesn't exist for this triple, so it doesn't shrink.
+
+define float @exp10_test1(float %f) {
%conv = fpext float %f to double
- %call = call double @exp10(double %conv)
+ %call = call fast double @exp10(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: exp10_test
-; CHECK: call double @exp10(double %conv)
+; CHECK-LABEL: exp10_test1
+; CHECK: call fast double @exp10(double %conv)
}
define double @exp10_test2(float %f) {
%conv = fpext float %f to double
- %call = call double @exp10(double %conv)
+ %call = call fast double @exp10(double %conv)
ret double %call
; CHECK-LABEL: exp10_test2
-; CHECK: call double @exp10(double %conv)
+; CHECK: call fast double @exp10(double %conv)
}
-define float @log_test(float %f) {
+
+define float @log_test1(float %f) {
%conv = fpext float %f to double
- %call = call double @log(double %conv)
+ %call = call fast double @log(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: log_test
-; CHECK: call float @logf(float %f)
+; CHECK-LABEL: log_test1
+; CHECK: call fast float @logf(float %f)
}
define double @log_test2(float %f) {
%conv = fpext float %f to double
- %call = call double @log(double %conv)
+ %call = call fast double @log(double %conv)
ret double %call
; CHECK-LABEL: log_test2
-; CHECK: call double @log(double %conv)
+; CHECK: call fast double @log(double %conv)
}
-define float @log10_test(float %f) {
+
+define float @log10_test1(float %f) {
%conv = fpext float %f to double
- %call = call double @log10(double %conv)
+ %call = call fast double @log10(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: log10_test
-; CHECK: call float @log10f(float %f)
+; CHECK-LABEL: log10_test1
+; CHECK: call fast float @log10f(float %f)
}
define double @log10_test2(float %f) {
%conv = fpext float %f to double
- %call = call double @log10(double %conv)
+ %call = call fast double @log10(double %conv)
ret double %call
; CHECK-LABEL: log10_test2
-; CHECK: call double @log10(double %conv)
+; CHECK: call fast double @log10(double %conv)
}
-define float @log1p_test(float %f) {
+
+define float @log1p_test1(float %f) {
%conv = fpext float %f to double
- %call = call double @log1p(double %conv)
+ %call = call fast double @log1p(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: log1p_test
-; CHECK: call float @log1pf(float %f)
+; CHECK-LABEL: log1p_test1
+; CHECK: call fast float @log1pf(float %f)
}
define double @log1p_test2(float %f) {
%conv = fpext float %f to double
- %call = call double @log1p(double %conv)
+ %call = call fast double @log1p(double %conv)
ret double %call
; CHECK-LABEL: log1p_test2
-; CHECK: call double @log1p(double %conv)
+; CHECK: call fast double @log1p(double %conv)
}
-define float @log2_test(float %f) {
+
+define float @log2_test1(float %f) {
%conv = fpext float %f to double
- %call = call double @log2(double %conv)
+ %call = call fast double @log2(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: log2_test
-; CHECK: call float @log2f(float %f)
+; CHECK-LABEL: log2_test1
+; CHECK: call fast float @log2f(float %f)
}
define double @log2_test2(float %f) {
%conv = fpext float %f to double
- %call = call double @log2(double %conv)
+ %call = call fast double @log2(double %conv)
ret double %call
; CHECK-LABEL: log2_test2
-; CHECK: call double @log2(double %conv)
+; CHECK: call fast double @log2(double %conv)
}
-define float @logb_test(float %f) {
+
+define float @logb_test1(float %f) {
%conv = fpext float %f to double
- %call = call double @logb(double %conv)
+ %call = call fast double @logb(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: logb_test
-; CHECK: call float @logbf(float %f)
+; CHECK-LABEL: logb_test1
+; CHECK: call fast float @logbf(float %f)
}
define double @logb_test2(float %f) {
%conv = fpext float %f to double
- %call = call double @logb(double %conv)
+ %call = call fast double @logb(double %conv)
ret double %call
; CHECK-LABEL: logb_test2
-; CHECK: call double @logb(double %conv)
+; CHECK: call fast double @logb(double %conv)
}
-define float @sin_test(float %f) {
+
+define float @sin_test1(float %f) {
%conv = fpext float %f to double
- %call = call double @sin(double %conv)
+ %call = call fast double @sin(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: sin_test
-; CHECK: call float @sinf(float %f)
+; CHECK-LABEL: sin_test1
+; CHECK: call fast float @sinf(float %f)
}
define double @sin_test2(float %f) {
%conv = fpext float %f to double
- %call = call double @sin(double %conv)
+ %call = call fast double @sin(double %conv)
ret double %call
; CHECK-LABEL: sin_test2
-; CHECK: call double @sin(double %conv)
+; CHECK: call fast double @sin(double %conv)
}
-define float @sqrt_test(float %f) {
+define float @sqrt_test1(float %f) {
%conv = fpext float %f to double
%call = call double @sqrt(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: sqrt_test
+; CHECK-LABEL: sqrt_test1
; CHECK: call float @sqrtf(float %f)
}
@@ -287,12 +300,12 @@ define double @sqrt_test2(float %f) {
; CHECK: call double @sqrt(double %conv)
}
-define float @sqrt_int_test(float %f) {
+define float @sqrt_int_test1(float %f) {
%conv = fpext float %f to double
%call = call double @llvm.sqrt.f64(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: sqrt_int_test
+; CHECK-LABEL: sqrt_int_test1
; CHECK: call float @llvm.sqrt.f32(float %f)
}
@@ -304,39 +317,55 @@ define double @sqrt_int_test2(float %f) {
; CHECK: call double @llvm.sqrt.f64(double %conv)
}
-define float @tan_test(float %f) {
+define float @tan_test1(float %f) {
%conv = fpext float %f to double
- %call = call double @tan(double %conv)
+ %call = call fast double @tan(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: tan_test
-; CHECK: call float @tanf(float %f)
+; CHECK-LABEL: tan_test1
+; CHECK: call fast float @tanf(float %f)
}
define double @tan_test2(float %f) {
%conv = fpext float %f to double
- %call = call double @tan(double %conv)
+ %call = call fast double @tan(double %conv)
ret double %call
; CHECK-LABEL: tan_test2
-; CHECK: call double @tan(double %conv)
+; CHECK: call fast double @tan(double %conv)
}
-define float @tanh_test(float %f) {
+define float @tanh_test1(float %f) {
%conv = fpext float %f to double
- %call = call double @tanh(double %conv)
+ %call = call fast double @tanh(double %conv)
%conv1 = fptrunc double %call to float
ret float %conv1
-; CHECK-LABEL: tanh_test
-; CHECK: call float @tanhf(float %f)
+; CHECK-LABEL: tanh_test1
+; CHECK: call fast float @tanhf(float %f)
}
define double @tanh_test2(float %f) {
%conv = fpext float %f to double
- %call = call double @tanh(double %conv)
+ %call = call fast double @tanh(double %conv)
ret double %call
; CHECK-LABEL: tanh_test2
-; CHECK: call double @tanh(double %conv)
+; CHECK: call fast double @tanh(double %conv)
}
+; 'arcp' on an fmax() is meaningless. This test just proves that
+; flags are propagated for shrunken *binary* double FP calls.
+define float @max1(float %a, float %b) {
+ %c = fpext float %a to double
+ %d = fpext float %b to double
+ %e = call arcp double @fmax(double %c, double %d)
+ %f = fptrunc double %e to float
+ ret float %f
+
+; CHECK-LABEL: max1(
+; CHECK-NEXT: call arcp float @fmaxf(float %a, float %b)
+; CHECK-NEXT: ret
+}
+
+declare double @fmax(double, double)
+
declare double @tanh(double) #1
declare double @tan(double) #1
diff --git a/test/Transforms/InstCombine/fast-math.ll b/test/Transforms/InstCombine/fast-math.ll
index fd563481b3ed..5bdf48b85ce7 100644
--- a/test/Transforms/InstCombine/fast-math.ll
+++ b/test/Transforms/InstCombine/fast-math.ll
@@ -733,13 +733,12 @@ declare fp128 @fminl(fp128, fp128)
; This should always be set when unsafe-fp-math is true, but
; alternate the attributes for additional test coverage.
; 'nsz' is implied by the definition of fmax or fmin itself.
-attributes #1 = { "no-nans-fp-math" = "true" }
; Shrink and remove the call.
-define float @max1(float %a, float %b) #0 {
+define float @max1(float %a, float %b) {
%c = fpext float %a to double
%d = fpext float %b to double
- %e = call double @fmax(double %c, double %d)
+ %e = call fast double @fmax(double %c, double %d)
%f = fptrunc double %e to float
ret float %f
@@ -749,8 +748,8 @@ define float @max1(float %a, float %b) #0 {
; CHECK-NEXT: ret
}
-define float @max2(float %a, float %b) #1 {
- %c = call float @fmaxf(float %a, float %b)
+define float @max2(float %a, float %b) {
+ %c = call nnan float @fmaxf(float %a, float %b)
ret float %c
; CHECK-LABEL: max2(
@@ -760,8 +759,8 @@ define float @max2(float %a, float %b) #1 {
}
-define double @max3(double %a, double %b) #0 {
- %c = call double @fmax(double %a, double %b)
+define double @max3(double %a, double %b) {
+ %c = call fast double @fmax(double %a, double %b)
ret double %c
; CHECK-LABEL: max3(
@@ -770,8 +769,8 @@ define double @max3(double %a, double %b) #0 {
; CHECK-NEXT: ret
}
-define fp128 @max4(fp128 %a, fp128 %b) #1 {
- %c = call fp128 @fmaxl(fp128 %a, fp128 %b)
+define fp128 @max4(fp128 %a, fp128 %b) {
+ %c = call nnan fp128 @fmaxl(fp128 %a, fp128 %b)
ret fp128 %c
; CHECK-LABEL: max4(
@@ -781,10 +780,10 @@ define fp128 @max4(fp128 %a, fp128 %b) #1 {
}
; Shrink and remove the call.
-define float @min1(float %a, float %b) #1 {
+define float @min1(float %a, float %b) {
%c = fpext float %a to double
%d = fpext float %b to double
- %e = call double @fmin(double %c, double %d)
+ %e = call nnan double @fmin(double %c, double %d)
%f = fptrunc double %e to float
ret float %f
@@ -794,8 +793,8 @@ define float @min1(float %a, float %b) #1 {
; CHECK-NEXT: ret
}
-define float @min2(float %a, float %b) #0 {
- %c = call float @fminf(float %a, float %b)
+define float @min2(float %a, float %b) {
+ %c = call fast float @fminf(float %a, float %b)
ret float %c
; CHECK-LABEL: min2(
@@ -804,8 +803,8 @@ define float @min2(float %a, float %b) #0 {
; CHECK-NEXT: ret
}
-define double @min3(double %a, double %b) #1 {
- %c = call double @fmin(double %a, double %b)
+define double @min3(double %a, double %b) {
+ %c = call nnan double @fmin(double %a, double %b)
ret double %c
; CHECK-LABEL: min3(
@@ -814,8 +813,8 @@ define double @min3(double %a, double %b) #1 {
; CHECK-NEXT: ret
}
-define fp128 @min4(fp128 %a, fp128 %b) #0 {
- %c = call fp128 @fminl(fp128 %a, fp128 %b)
+define fp128 @min4(fp128 %a, fp128 %b) {
+ %c = call fast fp128 @fminl(fp128 %a, fp128 %b)
ret fp128 %c
; CHECK-LABEL: min4(
diff --git a/test/Transforms/InstCombine/insert-extract-shuffle.ll b/test/Transforms/InstCombine/insert-extract-shuffle.ll
index c75c771407e5..4223660db3d6 100644
--- a/test/Transforms/InstCombine/insert-extract-shuffle.ll
+++ b/test/Transforms/InstCombine/insert-extract-shuffle.ll
@@ -72,3 +72,56 @@ define <8 x float> @widen_extract4(<8 x float> %ins, <2 x float> %ext) {
ret <8 x float> %i1
}
+; PR26015: https://llvm.org/bugs/show_bug.cgi?id=26015
+; The widening shuffle must be inserted before any uses.
+
+define <8 x i16> @pr26015(<4 x i16> %t0) {
+; CHECK-LABEL: @pr26015(
+; CHECK-NEXT: %[[WIDEVEC:.*]] = shufflevector <4 x i16> %t0, <4 x i16> undef, <8 x i32> <i32 undef, i32 undef, i32 undef, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
+; CHECK-NEXT: %[[EXT:.*]] = extractelement <4 x i16> %t0, i32 2
+; CHECK-NEXT: %t2 = insertelement <8 x i16> <i16 0, i16 0, i16 0, i16 undef, i16 0, i16 0, i16 undef, i16 undef>, i16 %[[EXT]], i32 3
+; CHECK-NEXT: %t3 = insertelement <8 x i16> %t2, i16 0, i32 6
+; CHECK-NEXT: %t5 = shufflevector <8 x i16> %t3, <8 x i16> %[[WIDEVEC]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 11>
+; CHECK-NEXT: ret <8 x i16> %t5
+ %t1 = extractelement <4 x i16> %t0, i32 2
+ %t2 = insertelement <8 x i16> zeroinitializer, i16 %t1, i32 3
+ %t3 = insertelement <8 x i16> %t2, i16 0, i32 6
+ %t4 = extractelement <4 x i16> %t0, i32 3
+ %t5 = insertelement <8 x i16> %t3, i16 %t4, i32 7
+ ret <8 x i16> %t5
+}
+
+; PR25999: https://llvm.org/bugs/show_bug.cgi?id=25999
+; TODO: The widening shuffle could be inserted at the start of the function to allow the first extract to use it.
+
+define <8 x i16> @pr25999(<4 x i16> %t0, i1 %b) {
+; CHECK-LABEL: @pr25999(
+; CHECK-NEXT: %t1 = extractelement <4 x i16> %t0, i32 2
+; CHECK-NEXT: br i1 %b, label %if, label %end
+; CHECK: if:
+; CHECK-NEXT: %[[WIDEVEC:.*]] = shufflevector <4 x i16> %t0, <4 x i16> undef, <8 x i32> <i32 undef, i32 undef, i32 undef, i32 3, i32 undef, i32 undef, i32 undef, i32 undef>
+; CHECK-NEXT: %t2 = insertelement <8 x i16> <i16 0, i16 0, i16 0, i16 undef, i16 0, i16 0, i16 undef, i16 undef>, i16 %t1, i32 3
+; CHECK-NEXT: %t3 = insertelement <8 x i16> %t2, i16 0, i32 6
+; CHECK-NEXT: %t5 = shufflevector <8 x i16> %t3, <8 x i16> %[[WIDEVEC]], <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 11>
+; CHECK-NEXT: ret <8 x i16> %t5
+; CHECK: end:
+; CHECK-NEXT: %a1 = add i16 %t1, 4
+; CHECK-NEXT: %t6 = insertelement <8 x i16> <i16 undef, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0, i16 0>, i16 %a1, i32 0
+; CHECK-NEXT: ret <8 x i16> %t6
+
+ %t1 = extractelement <4 x i16> %t0, i32 2
+ br i1 %b, label %if, label %end
+
+if:
+ %t2 = insertelement <8 x i16> zeroinitializer, i16 %t1, i32 3
+ %t3 = insertelement <8 x i16> %t2, i16 0, i32 6
+ %t4 = extractelement <4 x i16> %t0, i32 3
+ %t5 = insertelement <8 x i16> %t3, i16 %t4, i32 7
+ ret <8 x i16> %t5
+
+end:
+ %a1 = add i16 %t1, 4
+ %t6 = insertelement <8 x i16> zeroinitializer, i16 %a1, i32 0
+ ret <8 x i16> %t6
+}
+
diff --git a/test/Transforms/InstCombine/token.ll b/test/Transforms/InstCombine/token.ll
index 0929cf7ebee1..f96b85b4f225 100644
--- a/test/Transforms/InstCombine/token.ll
+++ b/test/Transforms/InstCombine/token.ll
@@ -85,5 +85,22 @@ unreachable:
; CHECK: %Y = zext i8 %B to i32
; CHECK: %phi = phi i32 [ %X, %bb ], [ %Y, %cont ], [ %Y, %cont2 ]
+declare void @foo()
+declare token @llvm.experimental.gc.statepoint.p0f_isVoidf(i64, i32, void ()*, i32, i32, ...)
+
+define void @test4(i8 addrspace(1)* %obj) gc "statepoint-example" {
+bb:
+ unreachable
+
+unreachable:
+ call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0)
+ ret void
+}
+
+; CHECK-LABEL: define void @test4(
+; CHECK: unreachable:
+; CHECK: call token (i64, i32, void ()*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidf(i64 0, i32 0, void ()* @foo, i32 0, i32 0, i32 0, i32 5, i32 0, i32 -1, i32 0, i32 0, i32 0)
+; CHECK: ret void
+
declare void @g(i32)