[llvm] 6e1a6f6 - [GlobalOpt] add test checks; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Sat May 15 04:29:28 PDT 2021
Author: Sanjay Patel
Date: 2021-05-15T07:27:17-04:00
New Revision: 6e1a6f65371057224e1c5c79ba51a9916812021e
URL: https://github.com/llvm/llvm-project/commit/6e1a6f65371057224e1c5c79ba51a9916812021e
DIFF: https://github.com/llvm/llvm-project/commit/6e1a6f65371057224e1c5c79ba51a9916812021e.diff
LOG: [GlobalOpt] add test checks; NFC
I'm also adding an explicit data layout, so we can
confirm that alignment requirements/prefs are met.
I tried to use complete/scripted CHECK lines here,
but that fails with 1 of the globals, and not sure why.
Added:
Modified:
llvm/test/Transforms/GlobalOpt/externally-initialized-global-ctr.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/GlobalOpt/externally-initialized-global-ctr.ll b/llvm/test/Transforms/GlobalOpt/externally-initialized-global-ctr.ll
index 21603f4710193..46e7de2858409 100644
--- a/llvm/test/Transforms/GlobalOpt/externally-initialized-global-ctr.ll
+++ b/llvm/test/Transforms/GlobalOpt/externally-initialized-global-ctr.ll
@@ -2,6 +2,11 @@
; rdar://12580965.
; ObjC++ test case.
+; Make it easier to verify that alignment is correct/optimal:
+; 16-bit pointers with 32-bit ABI alignment and 128-bit preferred alignment
+
+target datalayout = "p:16:32:128"
+
%struct.ButtonInitData = type { i8* }
@_ZL14buttonInitData = internal global [1 x %struct.ButtonInitData] zeroinitializer, align 4
@@ -12,6 +17,8 @@
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @_GLOBAL__I_a, i8* null }]
@llvm.used = appending global [2 x i8*] [i8* getelementptr inbounds ([7 x i8], [7 x i8]* @"\01L_OBJC_METH_VAR_NAME_40", i32 0, i32 0), i8* bitcast (i8** @"\01L_OBJC_SELECTOR_REFERENCES_41" to i8*)]
+; CHECK: @[[_ZL14BUTTONINITDATA_0_0:[a-zA-Z0-9_$"\\.-]+]] = internal unnamed_addr global i8* null, align 4
+;.
define internal void @__cxx_global_var_init() section "__TEXT,__StaticInit,regular,pure_instructions" {
%1 = load i8*, i8** @"\01L_OBJC_SELECTOR_REFERENCES_41", !invariant.load !2009
store i8* %1, i8** getelementptr inbounds ([1 x %struct.ButtonInitData], [1 x %struct.ButtonInitData]* @_ZL14buttonInitData, i32 0, i32 0, i32 0), align 4
@@ -26,7 +33,11 @@ define internal void @_GLOBAL__I_a() section "__TEXT,__StaticInit,regular,pure_i
declare void @test(i8*)
define void @print() {
-; CHECK: %1 = load i8*, i8** @_ZL14buttonInitData.0.0, align 4
+; CHECK-LABEL: @print(
+; CHECK-NEXT: [[TMP1:%.*]] = load i8*, i8** @_ZL14buttonInitData.0.0, align 4
+; CHECK-NEXT: call void @test(i8* [[TMP1]])
+; CHECK-NEXT: ret void
+;
%1 = load i8*, i8** getelementptr inbounds ([1 x %struct.ButtonInitData], [1 x %struct.ButtonInitData]* @_ZL14buttonInitData, i32 0, i32 0, i32 0), align 4
call void @test(i8* %1)
ret void
More information about the llvm-commits
mailing list