diff options
| author | Evandro Menezes <e.menezes@samsung.com> | 2018-02-16 20:00:57 +0000 |
|---|---|---|
| committer | Evandro Menezes <e.menezes@samsung.com> | 2018-02-16 20:00:57 +0000 |
| commit | 10ae20d80c9a6cf44c3ee7cc84bf51146293a977 (patch) | |
| tree | 7c5f8c7352794ec92840a6c932108c112c55b340 | |
| parent | 7b9ed656667b721fec90e3f193d363fa2f6ac305 (diff) | |
| download | bcm5719-llvm-10ae20d80c9a6cf44c3ee7cc84bf51146293a977.tar.gz bcm5719-llvm-10ae20d80c9a6cf44c3ee7cc84bf51146293a977.zip | |
[AArch64] Fix BITCAST lowering crash
The data type is assumed to be a vector, but sometimes it is not, leading
to an assertion.
Add simple test-case to verify this.
Differential revision: https://reviews.llvm.org/D42599
llvm-svn: 325378
| -rw-r--r-- | llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | 3 | ||||
| -rw-r--r-- | llvm/test/CodeGen/AArch64/strqu.ll | 28 |
2 files changed, 30 insertions, 1 deletions
diff --git a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp index d188f3f2688..fe2161039cd 100644 --- a/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp +++ b/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp @@ -8776,7 +8776,8 @@ static SDValue performBitcastCombine(SDNode *N, // If the source type has twice the number of elements as our destination // type, we know this is an extract of the high or low half of the vector. EVT SVT = Source->getValueType(0); - if (SVT.getVectorNumElements() != VT.getVectorNumElements() * 2) + if (!SVT.isVector() || + SVT.getVectorNumElements() != VT.getVectorNumElements() * 2) return SDValue(); DEBUG(dbgs() << "aarch64-lower: bitcast extract_subvector simplification\n"); diff --git a/llvm/test/CodeGen/AArch64/strqu.ll b/llvm/test/CodeGen/AArch64/strqu.ll new file mode 100644 index 00000000000..94b9ff3c3ba --- /dev/null +++ b/llvm/test/CodeGen/AArch64/strqu.ll @@ -0,0 +1,28 @@ +; RUN: llc < %s -verify-machineinstrs -mtriple=aarch64-linux-gnu | FileCheck --check-prefixes=CHECK,NOSPLIT %s +; RUN: llc < %s -verify-machineinstrs -mtriple=aarch64_be-linux-gnu | FileCheck --check-prefixes=CHECK,NOSPLIT %s +; RUN: llc < %s -verify-machineinstrs -mtriple=aarch64-linux-gnu -mcpu=exynos-m1 | FileCheck --check-prefixes=CHECK,NOSPLIT %s +; RUN: llc < %s -verify-machineinstrs -mtriple=aarch64_be-linux-gnu -mcpu=exynos-m1 | FileCheck --check-prefixes=CHECK,SPLIT %s + +; CHECK-LABEL: test_split_f: +; NOSPLIT: str q{{[0-9]+}}, [x{{[0-9]+}}] +; SPLIT: st1 { v{{[0-9]+}}.2s }, [x{{[0-9]+}}] +; SPLIT: st1 { v{{[0-9]+}}.2s }, [x{{[0-9]+}}] +define void @test_split_f(<4 x float> %val, <4 x float>* %addr) { + store <4 x float> %val, <4 x float>* %addr, align 8 + ret void +} + +; CHECK-LABEL: test_split_d: +; NOSPLIT: str q{{[0-9]+}}, [x{{[0-9]+}}] +; SPLIT: st1 { v{{[0-9]+}}.2d }, [x{{[0-9]+}}] +define void @test_split_d(<2 x double> %val, <2 x double>* %addr) { + store <2 x double> %val, <2 x double>* %addr, align 8 + ret void +} + +; CHECK-LABEL: test_split_128: +; CHECK: str q{{[0-9]+}}, [x{{[0-9]+}}] +define void @test_split_128(fp128 %val, fp128* %addr) { + store fp128 %val, fp128* %addr, align 8 + ret void +} |

