[OpenMPIRBuilder] Implicitly defined control blocks. NFC.
authorMichael Kruse <llvm-project@meinersbur.de>
Mon, 6 Dec 2021 20:08:07 +0000 (14:08 -0600)
committerMichael Kruse <llvm-project@meinersbur.de>
Mon, 6 Dec 2021 20:08:07 +0000 (14:08 -0600)
commitfed966f2a45614fb1c3f66a7aaf99dc75ec2026d
treeada002a7d259602cd15c096c09d02f091168586a
parentc5fef77bc35d3ba3ad110a9622cb533fa9a47883
[OpenMPIRBuilder] Implicitly defined control blocks. NFC.

Do not explicitly store the BasicBlocks for Preheader, Body and After inside CanonicalLoopInfo, but look the up when needed using their position relative to the other loop control blocks. By definition, instructions inside these are not managed by CanonicalLoopInfo (except terminator for Preheader) hence it makes sense to think of them as connections to the CanonicalLoopInfo instead of part of the CanonicalLoopInfo itself.

In particular for Preheader, it makes using SplitBasicBlock easier since inserting control flow at an InsertPoint may otherwise require updating the CanonicalLoopInfo's Preheader because the branch that jumps to the header is moved to another BasicBlock.

Reviewed By: ftynse

Differential Revision: https://reviews.llvm.org/D114368
llvm/include/llvm/Frontend/OpenMP/OMPIRBuilder.h
llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp