43 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 22; RUN: opt -passes=consthoist -consthoist-gep -S -o - %s | FileCheck %s3 4target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"5target triple = "thumbv6m-none--musleabi"6 7%0 = type { %1, %2, [9 x i16], %6, %7 }8%1 = type { i32, i32, i32, i32, i32, i32, i16, i16, i8, i8, i16, i32, i32, i16, i8, i8 }9%2 = type { i32, %3, i8, i8, i8, i8, i32, %4, %5, [16 x i8], i16, i16, i8, i8, i8, i8, i32, i32, i32 }10%3 = type { i16, i8, i8 }11%4 = type { i16, i8, i8 }12%5 = type { i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8, i8 }13%6 = type { i8, i8 }14%7 = type { [5 x i32], [3 x i32], [6 x i32], [3 x i32], [2 x i32], [4 x i32], [3 x i32], [2 x i32], [4 x i32], [5 x i32], [3 x i32], [6 x i32], [1 x i32], i32, i32, i32, i32, i32, i32 }15 16@global = external dso_local local_unnamed_addr global %0, align 417 18; Check that constant GEP expressions are rewritten to one-dimensional19; (single-index) GEPs, whose base poiner is a multi-dimensional GEP.20define dso_local void @zot() {21; CHECK-LABEL: define dso_local void @zot() {22; CHECK-NEXT: bb:23; CHECK-NEXT: [[CONST1:%.*]] = bitcast ptr getelementptr inbounds ([[TMP0:%.*]], ptr @global, i32 0, i32 4, i32 11, i32 0) to ptr24; CHECK-NEXT: [[CONST:%.*]] = bitcast ptr getelementptr inbounds ([[TMP0]], ptr @global, i32 0, i32 4, i32 0, i32 0) to ptr25; CHECK-NEXT: store i32 undef, ptr [[CONST]], align 426; CHECK-NEXT: [[MAT_GEP:%.*]] = getelementptr i8, ptr [[CONST]], i32 427; CHECK-NEXT: [[MAT_BITCAST:%.*]] = bitcast ptr [[MAT_GEP]] to ptr28; CHECK-NEXT: store i32 undef, ptr [[MAT_BITCAST]], align 429; CHECK-NEXT: store i32 undef, ptr [[CONST1]], align 430; CHECK-NEXT: [[MAT_GEP2:%.*]] = getelementptr i8, ptr [[CONST1]], i32 431; CHECK-NEXT: [[MAT_BITCAST3:%.*]] = bitcast ptr [[MAT_GEP2]] to ptr32; CHECK-NEXT: store i32 undef, ptr [[MAT_BITCAST3]], align 433; CHECK-NEXT: ret void34;35bb:36 store i32 undef, ptr getelementptr inbounds (%0, ptr @global, i32 0, i32 4, i32 0, i32 0), align 437 store i32 undef, ptr getelementptr inbounds (%0, ptr @global, i32 0, i32 4, i32 0, i32 1), align 438 store i32 undef, ptr getelementptr inbounds (%0, ptr @global, i32 0, i32 4, i32 11, i32 0), align 439 store i32 undef, ptr getelementptr inbounds (%0, ptr @global, i32 0, i32 4, i32 11, i32 1), align 440 ret void41}42 43