File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -1926,11 +1926,13 @@ void ForallOp::getCanonicalizationPatterns(RewritePatternSet &results,
1926
1926
// / not a constant.
1927
1927
void ForallOp::getSuccessorRegions (RegionBranchPoint point,
1928
1928
SmallVectorImpl<RegionSuccessor> ®ions) {
1929
- // Both the operation itself and the region may be branching into the body or
1930
- // back into the operation itself. It is possible for loop not to enter the
1931
- // body.
1932
- regions.push_back (RegionSuccessor (&getRegion ()));
1933
- regions.push_back (RegionSuccessor ());
1929
+ // In accordance with the semantics of forall, its body is executed in
1930
+ // parallel by multiple threads. We should not expect to branch back into
1931
+ // the forall body after the region's execution is complete.
1932
+ if (point.isParent ())
1933
+ regions.push_back (RegionSuccessor (&getRegion ()));
1934
+ else
1935
+ regions.push_back (RegionSuccessor ());
1934
1936
}
1935
1937
1936
1938
// ===----------------------------------------------------------------------===//
You can’t perform that action at this time.
0 commit comments