[llvm] r346816 - [MachineOutliner][NFC] Use flags set in all candidates to check for calls
Jessica Paquette via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 13 15:41:31 PST 2018
Author: paquette
Date: Tue Nov 13 15:41:31 2018
New Revision: 346816
URL: http://llvm.org/viewvc/llvm-project?rev=346816&view=rev
Log:
[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.)
Modified:
llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
Modified: llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp?rev=346816&r1=346815&r2=346816&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp Tue Nov 13 15:41:31 2018
@@ -5135,10 +5135,16 @@ AArch64InstrInfo::getOutliningCandidateI
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::getOutliningCandidateI
}
}
- // 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(),
More information about the llvm-commits
mailing list