brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · d33a2d3 Raw
77 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 52; RUN: opt -passes=instcombine -S -o - %s | FileCheck %s3; Tests that we don't crash upon encountering a vector GEP4 5target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"6target triple = "x86_64-unknown-linux-gnu"7 8%Dual = type { %Dual.72, %Partials.73 }9%Dual.72 = type { double, %Partials }10%Partials = type { [2 x double] }11%Partials.73 = type { [2 x %Dual.72] }12 13define <8 x ptr> @test_vector_gep(ptr %arg1, <8 x i64> %arg2) {14; CHECK-LABEL: define <8 x ptr> @test_vector_gep(15; CHECK-SAME: ptr [[ARG1:%.*]], <8 x i64> [[ARG2:%.*]]) {16; CHECK-NEXT:  [[TOP:.*:]]17; CHECK-NEXT:    [[VECTORGEP14_SPLIT:%.*]] = getelementptr inbounds [[DUAL:%.*]], ptr [[ARG1]], <8 x i64> [[ARG2]]18; CHECK-NEXT:    [[VECTORGEP14:%.*]] = getelementptr inbounds i8, <8 x ptr> [[VECTORGEP14_SPLIT]], i64 3219; CHECK-NEXT:    ret <8 x ptr> [[VECTORGEP14]]20;21top:22  %VectorGep14 = getelementptr inbounds %Dual, ptr %arg1, <8 x i64> %arg2, i32 1, i32 0, i64 0, i32 1, i32 0, i64 023  %0 = bitcast <8 x ptr> %VectorGep14 to <8 x ptr>24  ret <8 x ptr> %025}26 27%struct.A = type { i32, ptr }28%struct.B = type { i64, ptr }29%struct.C = type { i64 }30 31@G = internal global [65 x %struct.A] zeroinitializer, align 1632define <16 x ptr> @test() {33; CHECK-LABEL: define <16 x ptr> @test() {34; CHECK-NEXT:  [[VECTOR_BODY:.*:]]35; CHECK-NEXT:    ret <16 x ptr> getelementptr ([65 x %struct.A], ptr @G, <16 x i64> zeroinitializer, <16 x i64> <i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8, i64 9, i64 10, i64 11, i64 12, i64 13, i64 14, i64 15, i64 16>, i32 0)36;37vector.body:38  %VectorGep = getelementptr [65 x %struct.A], ptr @G, <16 x i64> zeroinitializer, <16 x i64> <i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8, i64 9, i64 10, i64 11, i64 12, i64 13, i64 14, i64 15, i64 16>, <16 x i32> zeroinitializer39  ret <16 x ptr> %VectorGep40}41 42define <16 x ptr> @test2() {43; CHECK-LABEL: define <16 x ptr> @test2() {44; CHECK-NEXT:  [[VECTOR_BODY:.*:]]45; CHECK-NEXT:    ret <16 x ptr> getelementptr ([65 x %struct.A], ptr @G, <16 x i64> zeroinitializer, <16 x i64> <i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8, i64 9, i64 10, i64 11, i64 12, i64 13, i64 14, i64 15, i64 16>, i32 0)46;47vector.body:48  %VectorGep = getelementptr [65 x %struct.A], ptr @G, <16 x i32> zeroinitializer, <16 x i64> <i64 1, i64 2, i64 3, i64 4, i64 5, i64 6, i64 7, i64 8, i64 9, i64 10, i64 11, i64 12, i64 13, i64 14, i64 15, i64 16>, <16 x i32> zeroinitializer49  ret <16 x ptr> %VectorGep50}51 52@g = external global i8, align 153 54define <2 x ptr> @constant_zero_index() {55; CHECK-LABEL: define <2 x ptr> @constant_zero_index() {56; CHECK-NEXT:    ret <2 x ptr> <ptr @g, ptr @g>57;58  %gep = getelementptr i8, ptr @g, <2 x i64> zeroinitializer59  ret <2 x ptr> %gep60}61 62define <2 x ptr> @constant_undef_index() {63; CHECK-LABEL: define <2 x ptr> @constant_undef_index() {64; CHECK-NEXT:    ret <2 x ptr> <ptr @g, ptr @g>65;66  %gep = getelementptr i8, ptr @g, <2 x i64> undef67  ret <2 x ptr> %gep68}69 70define <2 x ptr> @constant_inbounds() {71; CHECK-LABEL: define <2 x ptr> @constant_inbounds() {72; CHECK-NEXT:    ret <2 x ptr> getelementptr (i8, ptr @g, <2 x i64> splat (i64 1))73;74  %gep = getelementptr i8, ptr @g, <2 x i64> <i64 1, i64 1>75  ret <2 x ptr> %gep76}77