[llvm] bcde9f1 - [Test] Add loop load PRE test with GC pointers
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 19 21:31:19 PDT 2021
Author: Max Kazantsev
Date: 2021-04-20T11:30:54+07:00
New Revision: bcde9f1b6c8fe17dc055218aafe320177595cbb2
URL: https://github.com/llvm/llvm-project/commit/bcde9f1b6c8fe17dc055218aafe320177595cbb2
DIFF: https://github.com/llvm/llvm-project/commit/bcde9f1b6c8fe17dc055218aafe320177595cbb2.diff
LOG: [Test] Add loop load PRE test with GC pointers
Added:
Modified:
llvm/test/Transforms/GVN/PRE/pre-loop-load.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/GVN/PRE/pre-loop-load.ll b/llvm/test/Transforms/GVN/PRE/pre-loop-load.ll
index 77604dc9112c..6414dc4a25ca 100644
--- a/llvm/test/Transforms/GVN/PRE/pre-loop-load.ll
+++ b/llvm/test/Transforms/GVN/PRE/pre-loop-load.ll
@@ -7,6 +7,53 @@ declare void @may_free_memory()
declare i32 @personality_function()
+; TODO: We can PRE the load from gc-managed memory away from the hot path.
+define i32 @test_load_on_cold_path_gc(i32 addrspace(1)* %p) gc "statepoint-example" personality i32 ()* @"personality_function" {
+; CHECK-LABEL: @test_load_on_cold_path_gc(
+; CHECK-NEXT: entry:
+; CHECK-NEXT: br label [[LOOP:%.*]]
+; CHECK: loop:
+; CHECK-NEXT: [[IV:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[IV_NEXT:%.*]], [[BACKEDGE:%.*]] ]
+; CHECK-NEXT: [[X:%.*]] = load i32, i32 addrspace(1)* [[P:%.*]], align 4
+; CHECK-NEXT: [[COND:%.*]] = icmp ne i32 [[X]], 0
+; CHECK-NEXT: br i1 [[COND]], label [[HOT_PATH:%.*]], label [[COLD_PATH:%.*]]
+; CHECK: hot_path:
+; CHECK-NEXT: br label [[BACKEDGE]]
+; CHECK: cold_path:
+; CHECK-NEXT: call void @may_free_memory()
+; CHECK-NEXT: br label [[BACKEDGE]]
+; CHECK: backedge:
+; CHECK-NEXT: [[IV_NEXT]] = add i32 [[IV]], [[X]]
+; CHECK-NEXT: [[LOOP_COND:%.*]] = icmp ult i32 [[IV_NEXT]], 1000
+; CHECK-NEXT: br i1 [[LOOP_COND]], label [[LOOP]], label [[EXIT:%.*]]
+; CHECK: exit:
+; CHECK-NEXT: ret i32 [[X]]
+;
+entry:
+ br label %loop
+
+loop:
+ %iv = phi i32 [ 0, %entry], [%iv.next, %backedge]
+ %x = load i32, i32 addrspace(1)* %p
+ %cond = icmp ne i32 %x, 0
+ br i1 %cond, label %hot_path, label %cold_path
+
+hot_path:
+ br label %backedge
+
+cold_path:
+ call void @may_free_memory()
+ br label %backedge
+
+backedge:
+ %iv.next = add i32 %iv, %x
+ %loop.cond = icmp ult i32 %iv.next, 1000
+ br i1 %loop.cond, label %loop, label %exit
+
+exit:
+ ret i32 %x
+}
+
; TODO: We can PRE the load away from the hot path.
define i32 @test_load_on_cold_path(i32* %p) {
; CHECK-LABEL: @test_load_on_cold_path(
More information about the llvm-commits
mailing list