[llvm] 40c7542 - [SimplifyCFG] Add test for updating llvm.access.group when hoisting.
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 12 05:16:20 PST 2024
Author: Florian Hahn
Date: 2024-11-12T13:14:30Z
New Revision: 40c75426a9af601ba94762ad10317800a6b25ca4
URL: https://github.com/llvm/llvm-project/commit/40c75426a9af601ba94762ad10317800a6b25ca4
DIFF: https://github.com/llvm/llvm-project/commit/40c75426a9af601ba94762ad10317800a6b25ca4.diff
LOG: [SimplifyCFG] Add test for updating llvm.access.group when hoisting.
Add extra test coverage for preserving llvm.access.group metadata when
hoisting.
Added:
Modified:
llvm/test/Transforms/SimplifyCFG/preserve-load-metadata.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/SimplifyCFG/preserve-load-metadata.ll b/llvm/test/Transforms/SimplifyCFG/preserve-load-metadata.ll
index 89b6bfb566e09f..e6fdeb79e5e394 100644
--- a/llvm/test/Transforms/SimplifyCFG/preserve-load-metadata.ll
+++ b/llvm/test/Transforms/SimplifyCFG/preserve-load-metadata.ll
@@ -1,15 +1,24 @@
+; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -hoist-common-insts=true -S | FileCheck %s
declare void @bar(ptr)
declare void @baz(ptr)
-; CHECK-LABEL: @test_load_combine_metadata(
; Check that align metadata is combined
-; CHECK: load ptr, ptr %p
-; CHECK-SAME: !align ![[ALIGN:[0-9]+]]
-; CHECK: t:
-; CHECK: f:
define void @test_load_combine_metadata(i1 %c, ptr %p) {
+; CHECK-LABEL: define void @test_load_combine_metadata(
+; CHECK-SAME: i1 [[C:%.*]], ptr [[P:%.*]]) {
+; CHECK-NEXT: [[V1:%.*]] = load ptr, ptr [[P]], align 8, !align [[META0:![0-9]+]]
+; CHECK-NEXT: br i1 [[C]], label %[[T:.*]], label %[[F:.*]]
+; CHECK: [[T]]:
+; CHECK-NEXT: call void @bar(ptr [[V1]])
+; CHECK-NEXT: br label %[[CONT:.*]]
+; CHECK: [[F]]:
+; CHECK-NEXT: call void @baz(ptr [[V1]])
+; CHECK-NEXT: br label %[[CONT]]
+; CHECK: [[CONT]]:
+; CHECK-NEXT: ret void
+;
br i1 %c, label %t, label %f
t:
@@ -26,7 +35,37 @@ cont:
ret void
}
-; CHECK: ![[ALIGN]] = !{i64 8}
+define i64 @test_intersect_access_grou_metadata(i1 %c, ptr %p) {
+; CHECK-LABEL: define i64 @test_intersect_access_grou_metadata(
+; CHECK-SAME: i1 [[C:%.*]], ptr [[P:%.*]]) {
+; CHECK-NEXT: [[ENTRY:.*:]]
+; CHECK-NEXT: [[L_1:%.*]] = load i64, ptr [[P]], align 8, !llvm.access.group [[ACC_GRP1:![0-9]+]]
+; CHECK-NEXT: ret i64 [[L_1]]
+;
+entry:
+ br i1 %c, label %then, label %else
+
+then:
+ %l.1 = load i64, ptr %p, align 8, !llvm.access.group !2
+ br label %exit
+
+else:
+ %l.2 = load i64, ptr %p, align 8, !llvm.access.group !5
+ br label %exit
+
+exit:
+ %res = phi i64 [ %l.1, %then ], [ %l.2, %else ]
+ ret i64 %res
+}
!0 = !{i64 8}
!1 = !{i64 16}
+!2 = !{!3, !4}
+!3 = distinct !{}
+!4 = distinct !{}
+!5 = !{!3, !6}
+!6 = distinct !{}
+;.
+; CHECK: [[META0]] = !{i64 8}
+; CHECK: [[ACC_GRP1]] = distinct !{}
+;.
More information about the llvm-commits
mailing list