[llvm] 5c9a262 - [CodeGenPrepare][NFC] Pre-commit test for memory use count fix
Momchil Velikov via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 23 10:55:16 PDT 2023
Author: Momchil Velikov
Date: 2023-03-23T17:55:05Z
New Revision: 5c9a26238a198c115b7a14acd80d1505438438c5
URL: https://github.com/llvm/llvm-project/commit/5c9a26238a198c115b7a14acd80d1505438438c5
DIFF: https://github.com/llvm/llvm-project/commit/5c9a26238a198c115b7a14acd80d1505438438c5.diff
LOG: [CodeGenPrepare][NFC] Pre-commit test for memory use count fix
Reviewed By: mkazantsev
Differential Revision: https://reviews.llvm.org/D145705
Added:
llvm/test/CodeGen/Generic/addr-use-count.ll
Modified:
Removed:
################################################################################
diff --git a/llvm/test/CodeGen/Generic/addr-use-count.ll b/llvm/test/CodeGen/Generic/addr-use-count.ll
new file mode 100644
index 000000000000..a3b110bf6089
--- /dev/null
+++ b/llvm/test/CodeGen/Generic/addr-use-count.ll
@@ -0,0 +1,70 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
+; RUN: opt -S -codegenprepare < %s | FileCheck %s
+; REQUIRES: aarch64-registered-target
+
+; Test that `%addr` is sunk, even though the number of memory uses to scan exceeds the limit.
+
+target triple = "aarch64-linux"
+
+declare void @g(...)
+
+define void @f(ptr %p) {
+; CHECK-LABEL: @f(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: [[SUNKADDR:%.*]] = getelementptr i8, ptr [[P:%.*]], i64 4
+; CHECK-NEXT: [[T0:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[T1:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[T2:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[T3:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[T4:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[T5:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[T6:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[T7:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[T8:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[T9:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[T10:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[T11:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[T12:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[T13:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[T14:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[T15:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[T16:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[T17:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[T18:%.*]] = load i32, ptr [[SUNKADDR]], align 4
+; CHECK-NEXT: [[SUNKADDR1:%.*]] = getelementptr i8, ptr [[P]], i64 8
+; CHECK-NEXT: [[T19:%.*]] = load i32, ptr [[SUNKADDR1]], align 4
+; CHECK-NEXT: call void @g(i32 [[T0]], i32 [[T1]], i32 [[T2]], i32 [[T3]], i32 [[T4]], i32 [[T5]], i32 [[T6]], i32 [[T7]], i32 [[T8]], i32 [[T9]], i32 [[T10]], i32 [[T11]], i32 [[T12]], i32 [[T13]], i32 [[T14]], i32 [[T15]], i32 [[T16]], i32 [[T17]], i32 [[T18]], i32 [[T19]])
+; CHECK-NEXT: ret void
+;
+entry:
+ %addr = getelementptr i8, ptr %p, i32 4
+ br label %exit
+
+exit:
+ %t0 = load i32, ptr %addr
+ %t1 = load i32, ptr %addr
+ %t2 = load i32, ptr %addr
+ %t3 = load i32, ptr %addr
+ %t4 = load i32, ptr %addr
+ %t5 = load i32, ptr %addr
+ %t6 = load i32, ptr %addr
+ %t7 = load i32, ptr %addr
+ %t8 = load i32, ptr %addr
+ %t9 = load i32, ptr %addr
+ %t10 = load i32, ptr %addr
+ %t11 = load i32, ptr %addr
+ %t12 = load i32, ptr %addr
+ %t13 = load i32, ptr %addr
+ %t14 = load i32, ptr %addr
+ %t15 = load i32, ptr %addr
+ %t16 = load i32, ptr %addr
+ %t17 = load i32, ptr %addr
+ %t18 = load i32, ptr %addr
+ %addr.1 = getelementptr i8, ptr %addr, i32 4
+ %t19 = load i32, ptr %addr.1
+
+ call void @g(i32 %t0, i32 %t1, i32 %t2, i32 %t3, i32 %t4, i32 %t5, i32 %t6, i32 %t7,
+ i32 %t8, i32 %t9, i32 %t10, i32 %t11, i32 %t12, i32 %t13, i32 %t14, i32 %t15, i32 %t16,
+ i32 %t17, i32 %t18, i32 %t19)
+ ret void
+}
More information about the llvm-commits
mailing list