From d6e0ebea1054f6026ae4830f04a66eda9460572c Mon Sep 17 00:00:00 2001 From: John Brawn Date: Thu, 22 Nov 2018 11:45:23 +0000 Subject: [AArch64] Fix SelectionDAG infinite loop for v1i64 SCALAR_TO_VECTOR A consequence of r347274 is that SCALAR_TO_VECTOR can be converted into BUILD_VECTOR by SimplifyDemandedBits, but LowerBUILD_VECTOR can turn BUILD_VECTOR into SCALAR_TO_VECTOR so we get an infinite loop. Fix this by making LowerBUILD_VECTOR not do this transformation for those vectors that would get transformed back, i.e. BUILD_VECTOR of a single-element constant vector. Doing that means we get a DUP, which we then need to recognise in ISel as a copy. llvm-svn: 347456 --- llvm/test/CodeGen/AArch64/arm64-build-vector.ll | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'llvm/test/CodeGen/AArch64/arm64-build-vector.ll') diff --git a/llvm/test/CodeGen/AArch64/arm64-build-vector.ll b/llvm/test/CodeGen/AArch64/arm64-build-vector.ll index d7fe9c6d68b..d268f761c9a 100644 --- a/llvm/test/CodeGen/AArch64/arm64-build-vector.ll +++ b/llvm/test/CodeGen/AArch64/arm64-build-vector.ll @@ -53,3 +53,25 @@ define void @widen_f16_build_vector(half* %addr) { store <2 x half> , <2 x half>* %1, align 2 ret void } + +; Check that a single element vector is constructed with a mov +define <1 x i64> @single_element_vector_i64(<1 x i64> %arg) { +; CHECK-LABEL: single_element_vector_i64 +; CHECK: orr w[[GREG:[0-9]+]], wzr, #0x1 +; CHECK: fmov d[[DREG:[0-9]+]], x[[GREG]] +; CHECK: add d0, d0, d[[DREG]] +; CHECK: ret +entry: + %add = add <1 x i64> %arg, + ret <1 x i64> %add +} + +define <1 x double> @single_element_vector_double(<1 x double> %arg) { +; CHECK-LABEL: single_element_vector_double +; CHECK: fmov d[[DREG:[0-9]+]], #1.00000000 +; CHECK: fadd d0, d0, d[[DREG]] +; CHECK: ret +entry: + %add = fadd <1 x double> %arg, + ret <1 x double> %add +} -- cgit v1.2.3