Skip to content

Commit

Permalink
[ConstantHoisting] Regenerate test checks (NFC)
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Jun 21, 2023
1 parent e83c8c3 commit 82dca8a
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 37 deletions.
41 changes: 21 additions & 20 deletions llvm/test/Transforms/ConstantHoisting/AArch64/const-hoist-gep.ll
Original file line number Diff line number Diff line change
@@ -1,27 +1,8 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt -opaque-pointers=0 -passes=consthoist -consthoist-gep -S -o - %s | FileCheck %s

target triple = "aarch64-none--musleabi"

; Check that constant GEP expressions are rewritten to one-dimensional
; (single-index) GEPs, whose base poiner is a multi-dimensional GEP.
; CHECK: %const = bitcast i32* getelementptr inbounds (%0, %0* @global, i32 0, i32 4, i32 0, i32 0) to i32*
; CHECK-NEXT: store i32 undef, i32* %const, align 4

; CHECK-NEXT: %[[BC1:[a-z0-9_]+]] = bitcast i32* %const to i8*
; CHECK-NEXT: %[[M1:[a-z0-9_]+]] = getelementptr i8, i8* %[[BC1]], i32 4
; CHECK-NEXT: %[[BC2:[a-z0-9_]+]] = bitcast i8* %[[M1]] to i32*
; CHECK-NEXT: store i32 undef, i32* %[[BC2]], align 4

; CHECK-NEXT: %[[BC3:[a-z0-9_]+]] = bitcast i32* %const to i8*
; CHECK-NEXT: %[[M2:[a-z0-9_]+]] = getelementptr i8, i8* %[[BC3]], i32 160
; CHECK-NEXT: %[[BC4:[a-z0-9_]+]] = bitcast i8* %[[M2]] to i32*
; CHECK-NEXT: store i32 undef, i32* %[[BC4]], align 4

; CHECK-NEXT: %[[BC5:[a-z0-9_]+]] = bitcast i32* %const to i8*
; CHECK-NEXT: %[[M3:[a-z0-9_]+]] = getelementptr i8, i8* %[[BC5]], i32 164
; CHECK-NEXT: %[[BC6:[a-z0-9_]+]] = bitcast i8* %[[M3]] to i32*
; CHECK-NEXT: store i32 undef, i32* %[[BC6]], align 4

%0 = type { %1, %2, [9 x i16], %6, %7 }
%1 = type { i32, i32, i32, i32, i32, i32, i16, i16, i8, i8, i16, i32, i32, i16, i8, i8 }
%2 = type { i32, %3, i8, i8, i8, i8, i32, %4, %5, [16 x i8], i16, i16, i8, i8, i8, i8, i32, i32, i32 }
Expand All @@ -33,7 +14,27 @@ target triple = "aarch64-none--musleabi"

@global = external dso_local local_unnamed_addr global %0, align 4

; Check that constant GEP expressions are rewritten to one-dimensional
; (single-index) GEPs, whose base poiner is a multi-dimensional GEP.
define dso_local void @zot() {
; CHECK-LABEL: define dso_local void @zot() {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[CONST:%.*]] = bitcast i32* getelementptr inbounds ([[TMP0:%.*]], %0* @global, i32 0, i32 4, i32 0, i32 0) to i32*
; CHECK-NEXT: store i32 undef, i32* [[CONST]], align 4
; CHECK-NEXT: [[BASE_BITCAST:%.*]] = bitcast i32* [[CONST]] to i8*
; CHECK-NEXT: [[MAT_GEP:%.*]] = getelementptr i8, i8* [[BASE_BITCAST]], i32 4
; CHECK-NEXT: [[MAT_BITCAST:%.*]] = bitcast i8* [[MAT_GEP]] to i32*
; CHECK-NEXT: store i32 undef, i32* [[MAT_BITCAST]], align 4
; CHECK-NEXT: [[BASE_BITCAST1:%.*]] = bitcast i32* [[CONST]] to i8*
; CHECK-NEXT: [[MAT_GEP2:%.*]] = getelementptr i8, i8* [[BASE_BITCAST1]], i32 160
; CHECK-NEXT: [[MAT_BITCAST3:%.*]] = bitcast i8* [[MAT_GEP2]] to i32*
; CHECK-NEXT: store i32 undef, i32* [[MAT_BITCAST3]], align 4
; CHECK-NEXT: [[BASE_BITCAST4:%.*]] = bitcast i32* [[CONST]] to i8*
; CHECK-NEXT: [[MAT_GEP5:%.*]] = getelementptr i8, i8* [[BASE_BITCAST4]], i32 164
; CHECK-NEXT: [[MAT_BITCAST6:%.*]] = bitcast i8* [[MAT_GEP5]] to i32*
; CHECK-NEXT: store i32 undef, i32* [[MAT_BITCAST6]], align 4
; CHECK-NEXT: ret void
;
bb:
store i32 undef, i32* getelementptr inbounds (%0, %0* @global, i32 0, i32 4, i32 0, i32 0), align 4
store i32 undef, i32* getelementptr inbounds (%0, %0* @global, i32 0, i32 4, i32 0, i32 1), align 4
Expand Down
36 changes: 19 additions & 17 deletions llvm/test/Transforms/ConstantHoisting/ARM/const-hoist-gep.ll
Original file line number Diff line number Diff line change
@@ -1,25 +1,9 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 2
; RUN: opt -opaque-pointers=0 -passes=consthoist -consthoist-gep -S -o - %s | FileCheck %s

target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
target triple = "thumbv6m-none--musleabi"

; Check that constant GEP expressions are rewritten to one-dimensional
; (single-index) GEPs, whose base poiner is a multi-dimensional GEP.
; CHECK-DAG: %[[C1:const[0-9]?]] = bitcast i32* getelementptr inbounds (%0, %0* @global, i32 0, i32 4, i32 11, i32 0) to i32*
; CHECK-DAG: %[[C2:const[0-9]?]] = bitcast i32* getelementptr inbounds (%0, %0* @global, i32 0, i32 4, i32 0, i32 0) to i32*

; CHECK: store i32 undef, i32* %[[C2]], align 4
; CHECK-NEXT: %[[BC1:[a-z0-9_]+]] = bitcast i32* %[[C2]] to i8*
; CHECK-NEXT: %[[M1:[a-z0-9_]+]] = getelementptr i8, i8* %[[BC1]], i32 4
; CHECK-NEXT: %[[BC2:[a-z0-9_]+]] = bitcast i8* %[[M1]] to i32*
; CHECK-NEXT: store i32 undef, i32* %[[BC2]], align 4

; CHECK-NEXT: store i32 undef, i32* %[[C1]], align 4
; CHECK-NEXT: %[[BC3:[a-z0-9_]+]] = bitcast i32* %[[C1]] to i8*
; CHECK-NEXT: %[[M2:[a-z0-9_]+]] = getelementptr i8, i8* %[[BC3]], i32 4
; CHECK-NEXT: %[[BC4:[a-z0-9_]+]] = bitcast i8* %[[M2]] to i32*
; CHECK-NEXT: store i32 undef, i32* %[[BC4]], align 4

%0 = type { %1, %2, [9 x i16], %6, %7 }
%1 = type { i32, i32, i32, i32, i32, i32, i16, i16, i8, i8, i16, i32, i32, i16, i8, i8 }
%2 = type { i32, %3, i8, i8, i8, i8, i32, %4, %5, [16 x i8], i16, i16, i8, i8, i8, i8, i32, i32, i32 }
Expand All @@ -31,7 +15,25 @@ target triple = "thumbv6m-none--musleabi"

@global = external dso_local local_unnamed_addr global %0, align 4

; Check that constant GEP expressions are rewritten to one-dimensional
; (single-index) GEPs, whose base poiner is a multi-dimensional GEP.
define dso_local void @zot() {
; CHECK-LABEL: define dso_local void @zot() {
; CHECK-NEXT: bb:
; CHECK-NEXT: [[CONST1:%.*]] = bitcast i32* getelementptr inbounds ([[TMP0:%.*]], %0* @global, i32 0, i32 4, i32 11, i32 0) to i32*
; CHECK-NEXT: [[CONST:%.*]] = bitcast i32* getelementptr inbounds ([[TMP0]], %0* @global, i32 0, i32 4, i32 0, i32 0) to i32*
; CHECK-NEXT: store i32 undef, i32* [[CONST]], align 4
; CHECK-NEXT: [[BASE_BITCAST:%.*]] = bitcast i32* [[CONST]] to i8*
; CHECK-NEXT: [[MAT_GEP:%.*]] = getelementptr i8, i8* [[BASE_BITCAST]], i32 4
; CHECK-NEXT: [[MAT_BITCAST:%.*]] = bitcast i8* [[MAT_GEP]] to i32*
; CHECK-NEXT: store i32 undef, i32* [[MAT_BITCAST]], align 4
; CHECK-NEXT: store i32 undef, i32* [[CONST1]], align 4
; CHECK-NEXT: [[BASE_BITCAST2:%.*]] = bitcast i32* [[CONST1]] to i8*
; CHECK-NEXT: [[MAT_GEP3:%.*]] = getelementptr i8, i8* [[BASE_BITCAST2]], i32 4
; CHECK-NEXT: [[MAT_BITCAST4:%.*]] = bitcast i8* [[MAT_GEP3]] to i32*
; CHECK-NEXT: store i32 undef, i32* [[MAT_BITCAST4]], align 4
; CHECK-NEXT: ret void
;
bb:
store i32 undef, i32* getelementptr inbounds (%0, %0* @global, i32 0, i32 4, i32 0, i32 0), align 4
store i32 undef, i32* getelementptr inbounds (%0, %0* @global, i32 0, i32 4, i32 0, i32 1), align 4
Expand Down

0 comments on commit 82dca8a

Please sign in to comment.