summaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineLoopInfo.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2021-07-29 20:15:26 +0000
committerDimitry Andric <dim@FreeBSD.org>2021-07-29 20:15:26 +0000
commit344a3780b2e33f6ca763666c380202b18aab72a3 (patch)
treef0b203ee6eb71d7fdd792373e3c81eb18d6934dd /llvm/lib/CodeGen/MachineLoopInfo.cpp
parentb60736ec1405bb0a8dd40989f67ef4c93da068ab (diff)
Diffstat (limited to 'llvm/lib/CodeGen/MachineLoopInfo.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineLoopInfo.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/llvm/lib/CodeGen/MachineLoopInfo.cpp b/llvm/lib/CodeGen/MachineLoopInfo.cpp
index 78480d0e1488..8f91a5b698d0 100644
--- a/llvm/lib/CodeGen/MachineLoopInfo.cpp
+++ b/llvm/lib/CodeGen/MachineLoopInfo.cpp
@@ -115,8 +115,8 @@ DebugLoc MachineLoop::getStartLoc() const {
}
MachineBasicBlock *
-MachineLoopInfo::findLoopPreheader(MachineLoop *L,
- bool SpeculativePreheader) const {
+MachineLoopInfo::findLoopPreheader(MachineLoop *L, bool SpeculativePreheader,
+ bool FindMultiLoopPreheader) const {
if (MachineBasicBlock *PB = L->getLoopPreheader())
return PB;
@@ -139,12 +139,14 @@ MachineLoopInfo::findLoopPreheader(MachineLoop *L,
// Check if the preheader candidate is a successor of any other loop
// headers. We want to avoid having two loop setups in the same block.
- for (MachineBasicBlock *S : Preheader->successors()) {
- if (S == HB)
- continue;
- MachineLoop *T = getLoopFor(S);
- if (T && T->getHeader() == S)
- return nullptr;
+ if (!FindMultiLoopPreheader) {
+ for (MachineBasicBlock *S : Preheader->successors()) {
+ if (S == HB)
+ continue;
+ MachineLoop *T = getLoopFor(S);
+ if (T && T->getHeader() == S)
+ return nullptr;
+ }
}
return Preheader;
}