summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/fmul.ll
diff options
context:
space:
mode:
Diffstat (limited to 'test/Transforms/InstCombine/fmul.ll')
-rw-r--r--test/Transforms/InstCombine/fmul.ll37
1 files changed, 30 insertions, 7 deletions
diff --git a/test/Transforms/InstCombine/fmul.ll b/test/Transforms/InstCombine/fmul.ll
index 3671b4c6991cb..402ee52e624af 100644
--- a/test/Transforms/InstCombine/fmul.ll
+++ b/test/Transforms/InstCombine/fmul.ll
@@ -6,7 +6,7 @@ define float @test1(float %x) {
%mul = fmul float %sub, 2.0e+1
ret float %mul
-; CHECK: @test1
+; CHECK-LABEL: @test1(
; CHECK: fmul float %x, -2.000000e+01
}
@@ -16,7 +16,7 @@ define float @test2(float %x) {
%mul = fmul float %sub, 2.0e+1
ret float %mul
-; CHECK: @test2
+; CHECK-LABEL: @test2(
; CHECK: fmul float %x, -2.000000e+01
}
@@ -26,7 +26,7 @@ define float @test3(float %x, float %y) {
%sub2 = fsub float -0.000000e+00, %y
%mul = fmul float %sub1, %sub2
ret float %mul
-; CHECK: @test3
+; CHECK-LABEL: @test3(
; CHECK: fmul float %x, %y
}
@@ -36,7 +36,7 @@ define float @test4(float %x, float %y) {
%sub2 = fsub nsz float 0.000000e+00, %y
%mul = fmul float %sub1, %sub2
ret float %mul
-; CHECK: @test4
+; CHECK-LABEL: @test4(
; CHECK: fmul float %x, %y
}
@@ -45,7 +45,7 @@ define float @test5(float %x, float %y) {
%sub1 = fsub float -0.000000e+00, %x
%mul = fmul float %sub1, %y
ret float %mul
-; CHECK: @test5
+; CHECK-LABEL: @test5(
; CHECK: %1 = fmul float %x, %y
; CHECK: %mul = fsub float -0.000000e+00, %1
}
@@ -55,7 +55,7 @@ define float @test6(float %x, float %y) {
%sub1 = fsub nsz float 0.000000e+00, %x
%mul = fmul float %sub1, %y
ret float %mul
-; CHECK: @test6
+; CHECK-LABEL: @test6(
; CHECK: %1 = fmul float %x, %y
; CHECK: %mul = fsub float -0.000000e+00, %1
}
@@ -67,6 +67,29 @@ define float @test7(float %x, float %y) {
%mul = fmul float %sub1, %y
%mul2 = fmul float %mul, %sub1
ret float %mul2
-; CHECK: @test7
+; CHECK-LABEL: @test7(
; CHECK: fsub float -0.000000e+00, %x
}
+
+; Don't crash when attempting to cast a constant FMul to an instruction.
+define void @test8(i32* %inout) {
+entry:
+ %0 = load i32* %inout, align 4
+ %conv = uitofp i32 %0 to float
+ %vecinit = insertelement <4 x float> <float 0.000000e+00, float 0.000000e+00, float 0.000000e+00, float undef>, float %conv, i32 3
+ %sub = fsub <4 x float> <float -0.000000e+00, float -0.000000e+00, float -0.000000e+00, float -0.000000e+00>, %vecinit
+ %1 = shufflevector <4 x float> %sub, <4 x float> undef, <4 x i32> <i32 1, i32 1, i32 1, i32 1>
+ %mul = fmul <4 x float> zeroinitializer, %1
+ br label %for.cond
+
+for.cond: ; preds = %for.body, %entry
+ %local_var_7.0 = phi <4 x float> [ %mul, %entry ], [ %2, %for.body ]
+ br i1 undef, label %for.body, label %for.end
+
+for.body: ; preds = %for.cond
+ %2 = insertelement <4 x float> %local_var_7.0, float 0.000000e+00, i32 2
+ br label %for.cond
+
+for.end: ; preds = %for.cond
+ ret void
+}