[llvm] c349364 - [GlobalOpt] Split CleanupPointerRootUsers test with constant exprs.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 28 02:41:01 PST 2023
Author: Florian Hahn
Date: 2023-02-28T11:40:37+01:00
New Revision: c34936465c5648f825414fe76ccad7a9ad82dddd
URL: https://github.com/llvm/llvm-project/commit/c34936465c5648f825414fe76ccad7a9ad82dddd
DIFF: https://github.com/llvm/llvm-project/commit/c34936465c5648f825414fe76ccad7a9ad82dddd.diff
LOG: [GlobalOpt] Split CleanupPointerRootUsers test with constant exprs.
Split tests for D144468. Adding a test with an icmp constant expression
stopped CleanupPointerRootUsers from being called. Move it to a
separate test.
Added:
llvm/test/Transforms/GlobalOpt/cleanup-pointer-root-users-other-constexpr.ll
Modified:
llvm/test/Transforms/GlobalOpt/cleanup-pointer-root-users-gep-constexpr.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/GlobalOpt/cleanup-pointer-root-users-gep-constexpr.ll b/llvm/test/Transforms/GlobalOpt/cleanup-pointer-root-users-gep-constexpr.ll
index 4b0545634604c..fdcadc937b1f8 100644
--- a/llvm/test/Transforms/GlobalOpt/cleanup-pointer-root-users-gep-constexpr.ll
+++ b/llvm/test/Transforms/GlobalOpt/cleanup-pointer-root-users-gep-constexpr.ll
@@ -16,7 +16,6 @@ declare i32 @fn3()
define void @stores_single_use_gep_constexpr() {
; CHECK-LABEL: @stores_single_use_gep_constexpr(
; CHECK-NEXT: entry:
-; CHECK-NEXT: store ptr @fn0, ptr @global.20ptr, align 8
; CHECK-NEXT: store ptr @fn1, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR:%.*]], ptr @global.20ptr, i64 0, i32 1), align 8
; CHECK-NEXT: store ptr @fn2, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 2), align 8
; CHECK-NEXT: store ptr @fn3, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 3), align 8
@@ -25,13 +24,6 @@ define void @stores_single_use_gep_constexpr() {
; CHECK-NEXT: store ptr @fn2, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 6), align 8
; CHECK-NEXT: store ptr @fn3, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 7), align 8
; CHECK-NEXT: store ptr @fn0, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 8), align 8
-; CHECK-NEXT: store ptr @fn1, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 9), align 8
-; CHECK-NEXT: store ptr @fn2, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 10), align 8
-; CHECK-NEXT: store ptr @fn3, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 11), align 8
-; CHECK-NEXT: store ptr @fn0, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 12), align 8
-; CHECK-NEXT: store ptr @fn1, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 13), align 8
-; CHECK-NEXT: store ptr @fn2, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 14), align 8
-; CHECK-NEXT: store ptr @fn3, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 15), align 8
; CHECK-NEXT: ret void
;
entry:
@@ -44,13 +36,6 @@ entry:
store ptr @fn2, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 6), align 8
store ptr @fn3, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 7), align 8
store ptr @fn0, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 8), align 8
- store ptr @fn1, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 9), align 8
- store ptr @fn2, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 10), align 8
- store ptr @fn3, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 11), align 8
- store ptr @fn0, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 12), align 8
- store ptr @fn1, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 13), align 8
- store ptr @fn2, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 14), align 8
- store ptr @fn3, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 15), align 8
ret void
}
@@ -70,22 +55,9 @@ entry:
define void @stores_ptrtoint_constexpr() {
; CHECK-LABEL: @stores_ptrtoint_constexpr(
; CHECK-NEXT: entry:
-; CHECK-NEXT: store i32 0, ptr @global.20ptr, align 8
; CHECK-NEXT: ret void
;
entry:
store i32 0, ptr inttoptr (i64 ptrtoint (ptr @global.20ptr to i64) to ptr), align 8
ret void
}
-
-
- at global2.20ptr = internal unnamed_addr global %struct.global.20ptr zeroinitializer
-
-define i1 @icmp_constexpr() {
-; CHECK-LABEL: @icmp_constexpr(
-; CHECK-NEXT: entry:
-; CHECK-NEXT: ret i1 icmp eq (ptr @global.20ptr, ptr @global2.20ptr)
-;
-entry:
- ret i1 icmp eq (ptr @global.20ptr, ptr @global2.20ptr)
-}
diff --git a/llvm/test/Transforms/GlobalOpt/cleanup-pointer-root-users-other-constexpr.ll b/llvm/test/Transforms/GlobalOpt/cleanup-pointer-root-users-other-constexpr.ll
new file mode 100644
index 0000000000000..fdf888365bbda
--- /dev/null
+++ b/llvm/test/Transforms/GlobalOpt/cleanup-pointer-root-users-other-constexpr.ll
@@ -0,0 +1,52 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -passes=globalopt -S %s | FileCheck %s
+
+%struct.global.20ptr = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr, ptr }
+
+ at global.20ptr = internal unnamed_addr global %struct.global.20ptr zeroinitializer
+
+declare i32 @fn0()
+
+declare i32 @fn1()
+
+declare i32 @fn2()
+
+declare i32 @fn3()
+
+define void @stores_single_use_gep_constexpr() {
+; CHECK-LABEL: @stores_single_use_gep_constexpr(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: store ptr @fn0, ptr @global.20ptr, align 8
+; CHECK-NEXT: store ptr @fn1, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR:%.*]], ptr @global.20ptr, i64 0, i32 1), align 8
+; CHECK-NEXT: store ptr @fn2, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 2), align 8
+; CHECK-NEXT: store ptr @fn3, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 3), align 8
+; CHECK-NEXT: store ptr @fn0, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 4), align 8
+; CHECK-NEXT: store ptr @fn1, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 5), align 8
+; CHECK-NEXT: store ptr @fn2, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 6), align 8
+; CHECK-NEXT: store ptr @fn3, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 7), align 8
+; CHECK-NEXT: store ptr @fn0, ptr getelementptr inbounds ([[STRUCT_GLOBAL_20PTR]], ptr @global.20ptr, i64 0, i32 8), align 8
+; CHECK-NEXT: ret void
+;
+entry:
+ store ptr @fn0, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 0), align 8
+ store ptr @fn1, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 1), align 8
+ store ptr @fn2, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 2), align 8
+ store ptr @fn3, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 3), align 8
+ store ptr @fn0, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 4), align 8
+ store ptr @fn1, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 5), align 8
+ store ptr @fn2, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 6), align 8
+ store ptr @fn3, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 7), align 8
+ store ptr @fn0, ptr getelementptr inbounds (%struct.global.20ptr, ptr @global.20ptr, i64 0, i32 8), align 8
+ ret void
+}
+
+ at global2.20ptr = internal unnamed_addr global %struct.global.20ptr zeroinitializer
+
+define i1 @icmp_constexpr() {
+; CHECK-LABEL: @icmp_constexpr(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: ret i1 icmp eq (ptr @global.20ptr, ptr @global2.20ptr)
+;
+entry:
+ ret i1 icmp eq (ptr @global.20ptr, ptr @global2.20ptr)
+}
More information about the llvm-commits
mailing list