diff options
author | Joey Gouly <joey.gouly@arm.com> | 2013-09-30 14:18:35 +0000 |
---|---|---|
committer | Joey Gouly <joey.gouly@arm.com> | 2013-09-30 14:18:35 +0000 |
commit | 6ef4dd8cb6852fd0036244a07dc944dc8fb8933c (patch) | |
tree | 81c4f94db7ceb0a0209ec27b7543e813b1b74af5 /test/Transforms | |
parent | 6206a132a76d407fd276de17147d8c9c2c9e9e9d (diff) | |
download | external_llvm-6ef4dd8cb6852fd0036244a07dc944dc8fb8933c.zip external_llvm-6ef4dd8cb6852fd0036244a07dc944dc8fb8933c.tar.gz external_llvm-6ef4dd8cb6852fd0036244a07dc944dc8fb8933c.tar.bz2 |
Fix a bug in InstCombine where it attempted to cast a Value* to an Instruction*
when it was actually a Constant*.
There are quite a few other casts to Instruction that might have the same problem,
but this is the only one I have a test case for.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191668 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms')
-rw-r--r-- | test/Transforms/InstCombine/fmul.ll | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/fmul.ll b/test/Transforms/InstCombine/fmul.ll index cf57bed..402ee52 100644 --- a/test/Transforms/InstCombine/fmul.ll +++ b/test/Transforms/InstCombine/fmul.ll @@ -70,3 +70,26 @@ define float @test7(float %x, float %y) { ; 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 +} |