From 57ab82784ddb8d21eb0041d52f8490d8fd404e29 Mon Sep 17 00:00:00 2001 From: Michael Kuperstein Date: Wed, 21 Dec 2016 17:34:21 +0000 Subject: [ConstantFolding] Fix vector GEPs harder For vector GEPs, CastGEPIndices can end up in an infinite recursion, because we compare the vector type to the scalar pointer type, find them different, and then try to cast a type to itself. Differential Revision: https://reviews.llvm.org/D28009 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@290260 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Analysis/ConstantFolding/vectorgep-crash.ll | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test/Analysis/ConstantFolding') diff --git a/test/Analysis/ConstantFolding/vectorgep-crash.ll b/test/Analysis/ConstantFolding/vectorgep-crash.ll index bcc96b2676b..e7a5117d6ed 100644 --- a/test/Analysis/ConstantFolding/vectorgep-crash.ll +++ b/test/Analysis/ConstantFolding/vectorgep-crash.ll @@ -17,3 +17,24 @@ top: %0 = bitcast <8 x double*> %VectorGep14 to <8 x i64*> ret <8 x i64*> %0 } + +%struct.A = type { i32, %struct.B* } +%struct.B = type { i64, %struct.C* } +%struct.C = type { i64 } + +@G = internal global [65 x %struct.A] zeroinitializer, align 16 +; CHECK-LABEL: @test +; CHECK: ret <16 x i32*> getelementptr ([65 x %struct.A], [65 x %struct.A]* @G, <16 x i64> zeroinitializer, <16 x i64> , <16 x i32> zeroinitializer) +define <16 x i32*> @test() { +vector.body: + %VectorGep = getelementptr [65 x %struct.A], [65 x %struct.A]* @G, <16 x i64> zeroinitializer, <16 x i64> , <16 x i32> zeroinitializer + ret <16 x i32*> %VectorGep +} + +; CHECK-LABEL: @test2 +; CHECK: ret <16 x i32*> getelementptr ([65 x %struct.A], [65 x %struct.A]* @G, <16 x i64> zeroinitializer, <16 x i64> @test2() { +vector.body: + %VectorGep = getelementptr [65 x %struct.A], [65 x %struct.A]* @G, <16 x i32> zeroinitializer, <16 x i64> , <16 x i32> zeroinitializer + ret <16 x i32*> %VectorGep +} -- cgit v1.2.3