Skip to content

Commit 4e97ec9

Browse files
author
Jessica Paquette
committed
[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
1 parent a77eae9 commit 4e97ec9

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

llvm/lib/Target/AArch64/AArch64InstrInfo.cpp

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5135,10 +5135,16 @@ AArch64InstrInfo::getOutliningCandidateInfo(
51355135
return Sum + getInstSizeInBytes(MI);
51365136
});
51375137

5138-
// Compute liveness information for each candidate.
5138+
// Properties about candidate MBBs that hold for all of them.
5139+
unsigned FlagsSetInAll = 0xF;
5140+
5141+
// Compute liveness information for each candidate, and set FlagsSetInAll.
51395142
const TargetRegisterInfo &TRI = getRegisterInfo();
51405143
std::for_each(RepeatedSequenceLocs.begin(), RepeatedSequenceLocs.end(),
5141-
[&TRI](outliner::Candidate &C) { C.initLRU(TRI); });
5144+
[&TRI, &FlagsSetInAll](outliner::Candidate &C) {
5145+
FlagsSetInAll &= C.Flags;
5146+
C.initLRU(TRI);
5147+
});
51425148

51435149
// According to the AArch64 Procedure Call Standard, the following are
51445150
// undefined on entry/exit from a function call:
@@ -5240,10 +5246,9 @@ AArch64InstrInfo::getOutliningCandidateInfo(
52405246
}
52415247
}
52425248

5243-
// If the MBB containing the first candidate has calls, then it's possible
5244-
// that we have calls in the candidate. If there are no calls, then there's
5245-
// no way that any candidate could have any calls.
5246-
if (FirstCand.Flags & MachineOutlinerMBBFlags::HasCalls) {
5249+
// Does every candidate's MBB contain a call? If so, then we might have a call
5250+
// in the range.
5251+
if (FlagsSetInAll & MachineOutlinerMBBFlags::HasCalls) {
52475252
// Check if the range contains a call. These require a save + restore of the
52485253
// link register.
52495254
if (std::any_of(FirstCand.front(), FirstCand.back(),

0 commit comments

Comments
 (0)