From 82dca8a6d0e33ca7dedda25b0de4acdf03255bfd Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Wed, 21 Jun 2023 11:19:58 +0200 Subject: [PATCH] [ConstantHoisting] Regenerate test checks (NFC) --- .../ConstantHoisting/AArch64/const-hoist-gep.ll | 41 +++++++++++----------- .../ConstantHoisting/ARM/const-hoist-gep.ll | 36 ++++++++++--------- 2 files changed, 40 insertions(+), 37 deletions(-) diff --git a/llvm/test/Transforms/ConstantHoisting/AArch64/const-hoist-gep.ll b/llvm/test/Transforms/ConstantHoisting/AArch64/const-hoist-gep.ll index 70da654..72f1b56 100644 --- a/llvm/test/Transforms/ConstantHoisting/AArch64/const-hoist-gep.ll +++ b/llvm/test/Transforms/ConstantHoisting/AArch64/const-hoist-gep.ll @@ -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 } @@ -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 diff --git a/llvm/test/Transforms/ConstantHoisting/ARM/const-hoist-gep.ll b/llvm/test/Transforms/ConstantHoisting/ARM/const-hoist-gep.ll index 32a3ef4..502b0b8 100644 --- a/llvm/test/Transforms/ConstantHoisting/ARM/const-hoist-gep.ll +++ b/llvm/test/Transforms/ConstantHoisting/ARM/const-hoist-gep.ll @@ -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 } @@ -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 -- 2.7.4