[MachineOutliner][NFC] Use flags set in all candidates to check for calls

If we keep track of if the ContainsCalls bit is set in the MBB flags for each
candidate, then we have a better chance of not checking the candidate for calls
at all.

This saves quite a few checks in some CTMark tests (~200 in Bullet, for
example.)

llvm-svn: 346816
This commit is contained in:
Jessica Paquette 2018-11-13 23:41:31 +00:00
parent a77eae96bf
commit 4e97ec94d9
1 changed files with 11 additions and 6 deletions

View File

@ -5135,10 +5135,16 @@ AArch64InstrInfo::getOutliningCandidateInfo(
return Sum + getInstSizeInBytes(MI);
});
// Compute liveness information for each candidate.
// Properties about candidate MBBs that hold for all of them.
unsigned FlagsSetInAll = 0xF;
// Compute liveness information for each candidate, and set FlagsSetInAll.
const TargetRegisterInfo &TRI = getRegisterInfo();
std::for_each(RepeatedSequenceLocs.begin(), RepeatedSequenceLocs.end(),
[&TRI](outliner::Candidate &C) { C.initLRU(TRI); });
[&TRI, &FlagsSetInAll](outliner::Candidate &C) {
FlagsSetInAll &= C.Flags;
C.initLRU(TRI);
});
// According to the AArch64 Procedure Call Standard, the following are
// undefined on entry/exit from a function call:
@ -5240,10 +5246,9 @@ AArch64InstrInfo::getOutliningCandidateInfo(
}
}
// If the MBB containing the first candidate has calls, then it's possible
// that we have calls in the candidate. If there are no calls, then there's
// no way that any candidate could have any calls.
if (FirstCand.Flags & MachineOutlinerMBBFlags::HasCalls) {
// Does every candidate's MBB contain a call? If so, then we might have a call
// in the range.
if (FlagsSetInAll & MachineOutlinerMBBFlags::HasCalls) {
// Check if the range contains a call. These require a save + restore of the
// link register.
if (std::any_of(FirstCand.front(), FirstCand.back(),