diff options
author | Reid Kleckner <rnk@google.com> | 2015-12-09 21:08:18 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2015-12-09 21:08:18 +0000 |
commit | 54ade23504e3472cfb64fe4815d911b6311a92ba (patch) | |
tree | 622d8b29cc69ac8ea6d275b58bc2152ac9d884ac /llvm | |
parent | c3826da895e5ac674ace2f1a05db18f442113f59 (diff) | |
download | bcm5719-llvm-54ade23504e3472cfb64fe4815d911b6311a92ba.tar.gz bcm5719-llvm-54ade23504e3472cfb64fe4815d911b6311a92ba.zip |
[Float2Int] Don't operate on vector instructions
This fixes a crash bug. It's also not clear if we'd want to do this
transform for vectors.
llvm-svn: 255155
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Transforms/Scalar/Float2Int.cpp | 2 | ||||
-rw-r--r-- | llvm/test/Transforms/Float2Int/basic.ll | 10 |
2 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/Float2Int.cpp b/llvm/lib/Transforms/Scalar/Float2Int.cpp index a9a4a24f8e9..7f5d78656b5 100644 --- a/llvm/lib/Transforms/Scalar/Float2Int.cpp +++ b/llvm/lib/Transforms/Scalar/Float2Int.cpp @@ -131,6 +131,8 @@ static Instruction::BinaryOps mapBinOpcode(unsigned Opcode) { // integer domain. void Float2Int::findRoots(Function &F, SmallPtrSet<Instruction*,8> &Roots) { for (auto &I : instructions(F)) { + if (isa<VectorType>(I.getType())) + continue; switch (I.getOpcode()) { default: break; case Instruction::FPToUI: diff --git a/llvm/test/Transforms/Float2Int/basic.ll b/llvm/test/Transforms/Float2Int/basic.ll index f4d946914cd..7f04a594dc8 100644 --- a/llvm/test/Transforms/Float2Int/basic.ll +++ b/llvm/test/Transforms/Float2Int/basic.ll @@ -254,3 +254,13 @@ define i32 @neg_calluser(i32 %value) { ret i32 %7 } declare double @g(double) + +; CHECK-LABEL: @neg_vector +; CHECK: %1 = uitofp <4 x i8> %a to <4 x float> +; CHECK: %2 = fptoui <4 x float> %1 to <4 x i16> +; CHECK: ret <4 x i16> %2 +define <4 x i16> @neg_vector(<4 x i8> %a) { + %1 = uitofp <4 x i8> %a to <4 x float> + %2 = fptoui <4 x float> %1 to <4 x i16> + ret <4 x i16> %2 +} |