[llvm] [GlobalOpt] Precommit tests for PR84694 (PR #87443)
Anshil Gandhi via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 11 02:31:38 PDT 2024
================
@@ -0,0 +1,42 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 4
+; RUN: opt -passes=globalopt < %s -S | FileCheck %s
+
+ at gv = internal unnamed_addr global [3 x ptr] zeroinitializer, align 16
+ at gv2 = internal unnamed_addr global i32 0, align 4
+
+;; This test includes a load from @gv. No stores
+;; or memintrinsics with destination @gv should be removed.
+define i32 @main_with_load_from_b() local_unnamed_addr {
+; CHECK-LABEL: define i32 @main_with_load_from_b() local_unnamed_addr {
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[E:%.*]] = alloca i32, align 4
+; CHECK-NEXT: store ptr [[E]], ptr getelementptr inbounds ([3 x ptr], ptr @gv, i64 0, i64 2), align 16
+; CHECK-NEXT: [[LOAD_B:%.*]] = load ptr, ptr getelementptr inbounds ([3 x ptr], ptr @gv, i64 0, i64 2), align 16
+; CHECK-NEXT: call void @llvm.memcpy.p0.p0.i64(ptr @gv, ptr null, i64 8, i1 false)
+; CHECK-NEXT: ret i32 0
+;
+entry:
+ %e = alloca i32, align 4
+ store ptr %e, ptr getelementptr inbounds ([3 x ptr], ptr @gv, i64 0, i64 2), align 16
----------------
gandhi56 wrote:
It is actually, it is one of the fallbacks I fix in the algorithm in my patch.
https://github.com/llvm/llvm-project/pull/87443
More information about the llvm-commits
mailing list