summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r--llvm/lib/CodeGen/FuncletLayout.cpp14
1 files changed, 5 insertions, 9 deletions
diff --git a/llvm/lib/CodeGen/FuncletLayout.cpp b/llvm/lib/CodeGen/FuncletLayout.cpp
index 9b40a1a7558..0cda11f53db 100644
--- a/llvm/lib/CodeGen/FuncletLayout.cpp
+++ b/llvm/lib/CodeGen/FuncletLayout.cpp
@@ -12,7 +12,6 @@
//
//===----------------------------------------------------------------------===//
#include "llvm/CodeGen/Passes.h"
-#include "llvm/ADT/MapVector.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
@@ -34,7 +33,7 @@ public:
}
static void
-collectFuncletMembers(MapVector<MachineBasicBlock *, int> &FuncletMembership,
+collectFuncletMembers(DenseMap<MachineBasicBlock *, int> &FuncletMembership,
int Funclet, MachineBasicBlock *MBB) {
// Don't revisit blocks.
if (FuncletMembership.count(MBB) > 0)
@@ -81,16 +80,13 @@ bool FuncletLayout::runOnMachineFunction(MachineFunction &F) {
if (FuncletBlocks.empty())
return false;
- MapVector<MachineBasicBlock *, int> FuncletMembership;
+ DenseMap<MachineBasicBlock *, int> FuncletMembership;
for (MachineBasicBlock *MBB : FuncletBlocks)
collectFuncletMembers(FuncletMembership, MBB->getNumber(), MBB);
- for (std::pair<llvm::MachineBasicBlock *, int> &FuncletMember :
- FuncletMembership) {
- // Move this block to the end of the function.
- MachineBasicBlock *MBB = FuncletMember.first;
- MBB->moveAfter(--F.end());
- }
+ F.sort([&](MachineBasicBlock &x, MachineBasicBlock &y) {
+ return FuncletMembership[&x] < FuncletMembership[&y];
+ });
// Conservatively assume we changed something.
return true;
OpenPOWER on IntegriCloud