mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
[OpenMPIRBuilder] Put the barrier in the exit block in createWorkshapeLoop
The original code was inserting the barrier at the location given by the caller. Make sure it is always inserted at the end of the loop exit block instead. Reviewed By: Meinersbur Differential Revision: https://reviews.llvm.org/D92849
This commit is contained in:
parent
47fa1c8edc
commit
f6c53da76a
@ -1104,7 +1104,8 @@ CanonicalLoopInfo *OpenMPIRBuilder::createStaticWorkshareLoop(
|
||||
|
||||
// Add the barrier if requested.
|
||||
if (NeedsBarrier)
|
||||
createBarrier(Loc, omp::Directive::OMPD_for, /* ForceSimpleCall */ false,
|
||||
createBarrier(LocationDescription(Builder.saveIP(), Loc.DL),
|
||||
omp::Directive::OMPD_for, /* ForceSimpleCall */ false,
|
||||
/* CheckCancelFlag */ false);
|
||||
|
||||
CLI->assertOK();
|
||||
|
@ -1155,6 +1155,13 @@ TEST_F(OpenMPIRBuilderTest, StaticWorkShareLoop) {
|
||||
// increment and in the statement that adds the lower bound to it.
|
||||
Value *IV = CLI->getIndVar();
|
||||
EXPECT_EQ(std::distance(IV->use_begin(), IV->use_end()), 3);
|
||||
|
||||
// The exit block should contain the "fini" call and the barrier call,
|
||||
// plus the call to obtain the thread ID.
|
||||
BasicBlock *ExitBlock = CLI->getExit();
|
||||
size_t NumCallsInExitBlock =
|
||||
count_if(*ExitBlock, [](Instruction &I) { return isa<CallInst>(I); });
|
||||
EXPECT_EQ(NumCallsInExitBlock, 3u);
|
||||
}
|
||||
|
||||
TEST_F(OpenMPIRBuilderTest, MasterDirective) {
|
||||
|
Loading…
Reference in New Issue
Block a user