aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineOutliner.cpp
diff options
context:
space:
mode:
authorAmara Emerson <amara@apple.com>2023-03-18 23:17:28 -0700
committerAmara Emerson <amara@apple.com>2023-03-20 11:17:10 -0700
commit41e9c4b88c28b0a6f3820b45000cedeced89206c (patch)
tree9a27e004f81d188340fcc48936d79d1e5868f6c1 /llvm/lib/CodeGen/MachineOutliner.cpp
parent6bd4d717d577b88e83a92ea865bb96dd5df45936 (diff)
downloadllvm-41e9c4b88c28b0a6f3820b45000cedeced89206c.zip
llvm-41e9c4b88c28b0a6f3820b45000cedeced89206c.tar.gz
llvm-41e9c4b88c28b0a6f3820b45000cedeced89206c.tar.bz2
[NFC][Outliner] Delete default ctors for Candidate & OutlinedFunction.
I think it's good practice to avoid having default ctors unless they're really valid/useful. For OutlinedFunction the default ctor was used to represent a bail-out value for getOutliningCandidateInfo(), so I changed the API to return an optional<getOutliningCandidateInfo> instead which seems a tad cleaner. Differential Revision: https://reviews.llvm.org/D146375
Diffstat (limited to 'llvm/lib/CodeGen/MachineOutliner.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineOutliner.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index 856b9bf..8d72208 100644
--- a/llvm/lib/CodeGen/MachineOutliner.cpp
+++ b/llvm/lib/CodeGen/MachineOutliner.cpp
@@ -655,21 +655,21 @@ void MachineOutliner::findCandidates(
const TargetInstrInfo *TII =
CandidatesForRepeatedSeq[0].getMF()->getSubtarget().getInstrInfo();
- OutlinedFunction OF =
+ std::optional<OutlinedFunction> OF =
TII->getOutliningCandidateInfo(CandidatesForRepeatedSeq);
// If we deleted too many candidates, then there's nothing worth outlining.
// FIXME: This should take target-specified instruction sizes into account.
- if (OF.Candidates.size() < 2)
+ if (!OF || OF->Candidates.size() < 2)
continue;
// Is it better to outline this candidate than not?
- if (OF.getBenefit() < 1) {
- emitNotOutliningCheaperRemark(StringLen, CandidatesForRepeatedSeq, OF);
+ if (OF->getBenefit() < 1) {
+ emitNotOutliningCheaperRemark(StringLen, CandidatesForRepeatedSeq, *OF);
continue;
}
- FunctionList.push_back(OF);
+ FunctionList.push_back(*OF);
}
}