aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineOutliner.cpp
diff options
context:
space:
mode:
authorJessica Paquette <jpaquette@apple.com>2018-11-13 23:01:34 +0000
committerJessica Paquette <jpaquette@apple.com>2018-11-13 23:01:34 +0000
commitcad864d49e90b95de39d62f71fb6d1b7172b7498 (patch)
treeec5e8277c3cb1137e9008e44625fa019bafdd028 /llvm/lib/CodeGen/MachineOutliner.cpp
parent9039b6012e2c18416aad0edae548c28159e12f8a (diff)
downloadllvm-cad864d49e90b95de39d62f71fb6d1b7172b7498.zip
llvm-cad864d49e90b95de39d62f71fb6d1b7172b7498.tar.gz
llvm-cad864d49e90b95de39d62f71fb6d1b7172b7498.tar.bz2
[MachineOutliner][NFC] Use MBB flags to avoid call checks in getOutliningInfo
We already determine a bunch of information about an MBB in getMachineOutlinerMBBFlags. We can reuse that information to avoid calculating things that must be false/true. The first thing we can easily check is if an outlined sequence could ever contain calls. There's no reason to walk over the outlined range, checking for calls, if we already know that there are no calls in the block containing the sequence. llvm-svn: 346809
Diffstat (limited to 'llvm/lib/CodeGen/MachineOutliner.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineOutliner.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index 6b9fadd..49d0893a 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -625,6 +625,9 @@ struct InstructionMapper {
/// Inverse of \p InstructionIntegerMap.
DenseMap<unsigned, MachineInstr *> IntegerInstructionMap;
+ /// Correspondence between \p MachineBasicBlocks and target-defined flags.
+ DenseMap<MachineBasicBlock *, unsigned> MBBFlagsMap;
+
/// The vector of unsigned integers that the module is mapped to.
std::vector<unsigned> UnsignedVec;
@@ -748,6 +751,9 @@ struct InstructionMapper {
if (!TII.isMBBSafeToOutlineFrom(MBB, Flags))
return;
+ // Store info for the MBB for later outlining.
+ MBBFlagsMap[&MBB] = Flags;
+
MachineBasicBlock::iterator It = MBB.begin();
// The number of instructions in this block that will be considered for
@@ -1106,10 +1112,11 @@ unsigned MachineOutliner::findCandidates(
MachineBasicBlock::iterator StartIt = Mapper.InstrList[StartIdx];
MachineBasicBlock::iterator EndIt = Mapper.InstrList[EndIdx];
+ MachineBasicBlock *MBB = StartIt->getParent();
CandidatesForRepeatedSeq.emplace_back(StartIdx, StringLen, StartIt,
- EndIt, StartIt->getParent(),
- FunctionList.size());
+ EndIt, MBB, FunctionList.size(),
+ Mapper.MBBFlagsMap[MBB]);
}
}