[llvm] fedbc68 - [Attributor] Check assumptions to improve `isAlignedBarrier` queries
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 23 20:35:36 PST 2023
Author: Johannes Doerfert
Date: 2023-01-23T20:34:26-08:00
New Revision: fedbc689e16b3843d6a5ac7cb6a293fb22475121
URL: https://github.com/llvm/llvm-project/commit/fedbc689e16b3843d6a5ac7cb6a293fb22475121
DIFF: https://github.com/llvm/llvm-project/commit/fedbc689e16b3843d6a5ac7cb6a293fb22475121.diff
LOG: [Attributor] Check assumptions to improve `isAlignedBarrier` queries
Added:
Modified:
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
llvm/test/Transforms/OpenMP/barrier_removal.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index fd68152468737..0dd38b566776a 100644
--- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
+++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
@@ -2265,7 +2265,9 @@ bool AANoSync::isAlignedBarrier(const CallBase &CB, bool ExecutedAligned) {
case Intrinsic::nvvm_barrier0_popc:
return true;
case Intrinsic::amdgcn_s_barrier:
- return ExecutedAligned;
+ if (ExecutedAligned)
+ return true;
+ break;
default:
break;
}
diff --git a/llvm/test/Transforms/OpenMP/barrier_removal.ll b/llvm/test/Transforms/OpenMP/barrier_removal.ll
index 0e294abef9f01..edc027372c10c 100644
--- a/llvm/test/Transforms/OpenMP/barrier_removal.ll
+++ b/llvm/test/Transforms/OpenMP/barrier_removal.ll
@@ -92,6 +92,22 @@ define void @pos_empty_7b() {
call void @unknown()
ret void
}
+define void @pos_empty_8(i1 %c) {
+; CHECK-LABEL: define {{[^@]+}}@pos_empty_8
+; CHECK-SAME: (i1 [[C:%.*]]) {
+; CHECK-NEXT: br i1 [[C]], label [[T:%.*]], label [[F:%.*]]
+; CHECK: t:
+; CHECK-NEXT: br label [[F]]
+; CHECK: f:
+; CHECK-NEXT: ret void
+;
+ br i1 %c, label %t, label %f
+t:
+ call void @llvm.amdgcn.s.barrier() "llvm.assume"="ompx_aligned_barrier"
+ br label %f
+f:
+ ret void
+}
define void @neg_empty_8() {
; CHECK-LABEL: define {{[^@]+}}@neg_empty_8() {
; CHECK-NEXT: call void @unknown()
@@ -965,7 +981,7 @@ m3:
}
!llvm.module.flags = !{!16,!15}
-!nvvm.annotations = !{!0,!1,!2,!3,!4,!5,!6,!7,!8,!9,!10,!11,!12,!13,!14,!17,!18,!19,!20,!21,!22}
+!nvvm.annotations = !{!0,!1,!2,!3,!4,!5,!6,!7,!8,!9,!10,!11,!12,!13,!14,!17,!18,!19,!20,!21,!22,!23}
!0 = !{void ()* @pos_empty_1, !"kernel", i32 1}
!1 = !{void ()* @pos_empty_2, !"kernel", i32 1}
@@ -975,6 +991,7 @@ m3:
!5 = !{void ()* @pos_empty_6, !"kernel", i32 1}
!17 = !{void ()* @pos_empty_7a, !"kernel", i32 1}
!18 = !{void ()* @pos_empty_7b, !"kernel", i32 1}
+!23 = !{void (i1)* @pos_empty_8, !"kernel", i32 1}
!6 = !{void ()* @neg_empty_8, !"kernel", i32 1}
!19 = !{void (i1)* @neg_empty_9, !"kernel", i32 1}
!20 = !{void ()* @pos_empty_10, !"kernel", i32 1}
@@ -1020,4 +1037,5 @@ m3:
; CHECK: [[META20:![0-9]+]] = !{ptr @pos_empty_10, !"kernel", i32 1}
; CHECK: [[META21:![0-9]+]] = !{ptr @pos_empty_11, !"kernel", i32 1}
; CHECK: [[META22:![0-9]+]] = !{ptr @neg_empty_12, !"kernel", i32 1}
+; CHECK: [[META23:![0-9]+]] = !{ptr @pos_empty_8, !"kernel", i32 1}
;.
More information about the llvm-commits
mailing list