[llvm] fe12d31 - [OpenMPOpt][FIX] Propagate IsReachingAlignedBarrier flag through calls
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 7 16:39:18 PDT 2023
Author: Johannes Doerfert
Date: 2023-07-07T16:38:34-07:00
New Revision: fe12d313ba9610d6f213a3cbf7ca9c1eb81f39e8
URL: https://github.com/llvm/llvm-project/commit/fe12d313ba9610d6f213a3cbf7ca9c1eb81f39e8
DIFF: https://github.com/llvm/llvm-project/commit/fe12d313ba9610d6f213a3cbf7ca9c1eb81f39e8.diff
LOG: [OpenMPOpt][FIX] Propagate IsReachingAlignedBarrier flag through calls
Added:
Modified:
llvm/lib/Transforms/IPO/OpenMPOpt.cpp
llvm/test/Transforms/OpenMP/value-simplify-openmp-opt.ll
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
index ba0a72bda0c8c4..e9c356a7a15555 100644
--- a/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
+++ b/llvm/lib/Transforms/IPO/OpenMPOpt.cpp
@@ -3174,13 +3174,13 @@ ChangeStatus AAExecutionDomainFunction::updateImpl(Attributor &A) {
if (!CB)
continue;
auto &CallOutED = CEDMap[{CB, POST}];
- if (setAndRecord(CallOutED.IsReachingAlignedBarrierOnly, false))
- Changed = true;
+ Changed |= setAndRecord(CallOutED.IsReachingAlignedBarrierOnly, false);
auto &CallInED = CEDMap[{CB, PRE}];
HitAlignedBarrierOrKnownEnd =
AlignedBarriers.count(CB) || !CallInED.IsReachingAlignedBarrierOnly;
if (HitAlignedBarrierOrKnownEnd)
break;
+ Changed |= setAndRecord(CallInED.IsReachingAlignedBarrierOnly, false);
}
if (HitAlignedBarrierOrKnownEnd)
continue;
@@ -3198,8 +3198,8 @@ ChangeStatus AAExecutionDomainFunction::updateImpl(Attributor &A) {
}
if (SyncBB != &EntryBB)
continue;
- if (setAndRecord(InterProceduralED.IsReachingAlignedBarrierOnly, false))
- Changed = true;
+ Changed |=
+ setAndRecord(InterProceduralED.IsReachingAlignedBarrierOnly, false);
}
return Changed ? ChangeStatus::CHANGED : ChangeStatus::UNCHANGED;
diff --git a/llvm/test/Transforms/OpenMP/value-simplify-openmp-opt.ll b/llvm/test/Transforms/OpenMP/value-simplify-openmp-opt.ll
index 5d630d9e7966a7..2cc12945fe3500 100644
--- a/llvm/test/Transforms/OpenMP/value-simplify-openmp-opt.ll
+++ b/llvm/test/Transforms/OpenMP/value-simplify-openmp-opt.ll
@@ -411,16 +411,19 @@ S:
ret void
}
-; FIXME: The load of QB3 should not be simplified to 0.
+; The load of QB3 should not be simplified to 0.
define void @kernel4b3(i1 %c) "kernel" {
; TUNIT-LABEL: define {{[^@]+}}@kernel4b3
; TUNIT-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
+; TUNIT-NEXT: store i32 0, ptr addrspace(3) @QB3, align 4
; TUNIT-NEXT: br i1 [[C]], label [[S:%.*]], label [[L:%.*]]
; TUNIT: L:
; TUNIT-NEXT: call void @sync()
-; TUNIT-NEXT: call void @use1(i32 0) #[[ATTR7]]
+; TUNIT-NEXT: [[V:%.*]] = load i32, ptr addrspace(3) @QB3, align 4
+; TUNIT-NEXT: call void @use1(i32 [[V]]) #[[ATTR7]]
; TUNIT-NEXT: ret void
; TUNIT: S:
+; TUNIT-NEXT: store i32 2, ptr addrspace(3) @QB3, align 4
; TUNIT-NEXT: call void @use1(i32 0) #[[ATTR7]]
; TUNIT-NEXT: call void @use1(i32 1) #[[ATTR7]]
; TUNIT-NEXT: call void @use1(i32 2) #[[ATTR7]]
@@ -429,12 +432,15 @@ define void @kernel4b3(i1 %c) "kernel" {
;
; CGSCC-LABEL: define {{[^@]+}}@kernel4b3
; CGSCC-SAME: (i1 [[C:%.*]]) #[[ATTR1]] {
+; CGSCC-NEXT: store i32 0, ptr addrspace(3) @QB3, align 4
; CGSCC-NEXT: br i1 [[C]], label [[S:%.*]], label [[L:%.*]]
; CGSCC: L:
; CGSCC-NEXT: call void @sync()
-; CGSCC-NEXT: call void @use1(i32 0) #[[ATTR6]]
+; CGSCC-NEXT: [[V:%.*]] = load i32, ptr addrspace(3) @QB3, align 4
+; CGSCC-NEXT: call void @use1(i32 [[V]]) #[[ATTR6]]
; CGSCC-NEXT: ret void
; CGSCC: S:
+; CGSCC-NEXT: store i32 2, ptr addrspace(3) @QB3, align 4
; CGSCC-NEXT: call void @use1(i32 0) #[[ATTR6]]
; CGSCC-NEXT: call void @use1(i32 1) #[[ATTR6]]
; CGSCC-NEXT: call void @use1(i32 2) #[[ATTR6]]
More information about the llvm-commits
mailing list