[llvm] [OpenMPOpt] Fix incorrect end-of-kernel barrier removal (PR #65670)
Daniel Woodworth via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 8 14:15:37 PDT 2023
================
@@ -2676,17 +2676,19 @@ struct AAExecutionDomainFunction : public AAExecutionDomain {
if (!ED.EncounteredAssumes.empty() && !A.isModulePass())
return;
- // We can remove this barrier, if it is one, or all aligned barriers
- // reaching the kernel end. In the latter case we can transitively work
- // our way back until we find a barrier that guards a side-effect if we
- // are dealing with the kernel end here.
+ // We can remove this barrier, if it is one, or aligned barriers reaching
+ // the kernel end (if CB is nullptr). Aligned barriers reaching the kernel
+ // end may have other successors besides the kernel end (especially if
+ // they're in loops) with non-local side-effects, so those barriers can
+ // only be removed if they also only reach the kernel end. If those
----------------
dwoodwor-intel wrote:
This should be "if they also only reach the kernel end or other aligned barriers", right?
And since `IsReachingAlignedBarrierOnly` doesn't take side-effects like the `@unknown()` call into account, I'd need to check something else to make sure there aren't any extra side-effect instructions after this barrier that aren't ahead of the kernel end. Would I need to do another backwards propagation for that? It seems like `EncounteredNonLocalSideEffect` is only for side-effects preceding the execution domain.
https://github.com/llvm/llvm-project/pull/65670
More information about the llvm-commits
mailing list