diff options
author | Jessica Paquette <jpaquette@apple.com> | 2018-07-27 18:21:57 +0000 |
---|---|---|
committer | Jessica Paquette <jpaquette@apple.com> | 2018-07-27 18:21:57 +0000 |
commit | 9d93c6026a61507db25e8615d82a2576bdc8b319 (patch) | |
tree | 5e224cb511db3f64b7223560fd40ef18310e80e4 /llvm/lib | |
parent | fcca45f0ddb94947009615029bfd480e649abd64 (diff) | |
download | bcm5719-llvm-9d93c6026a61507db25e8615d82a2576bdc8b319.tar.gz bcm5719-llvm-9d93c6026a61507db25e8615d82a2576bdc8b319.zip |
[MachineOutliner] Exit getOutliningCandidateInfo when we erase all candidates
There was a missing check for if a candidate list was entirely deleted. This
adds that check.
This fixes an asan failure caused by running test/CodeGen/AArch64/addsub_ext.ll
with the MachineOutliner enabled.
llvm-svn: 338148
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/CodeGen/MachineOutliner.cpp | 8 | ||||
-rw-r--r-- | llvm/lib/Target/AArch64/AArch64InstrInfo.cpp | 4 |
2 files changed, 11 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp index 1babe4239e5..28e4e2c6c87 100644 --- a/llvm/lib/CodeGen/MachineOutliner.cpp +++ b/llvm/lib/CodeGen/MachineOutliner.cpp @@ -979,7 +979,13 @@ unsigned MachineOutliner::findCandidates( // We've found something we might want to outline. // Create an OutlinedFunction to store it and check if it'd be beneficial // to outline. - OutlinedFunction OF = TII.getOutliningCandidateInfo(CandidatesForRepeatedSeq); + OutlinedFunction OF = + TII.getOutliningCandidateInfo(CandidatesForRepeatedSeq); + + // If we deleted every candidate, then there's nothing to outline. + if (OF.Candidates.empty()) + continue; + std::vector<unsigned> Seq; for (unsigned i = Leaf->SuffixIdx; i < Leaf->SuffixIdx + StringLen; i++) Seq.push_back(ST.Str[i]); diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp index dc3fa4f8c1d..230480cf1ce 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp @@ -4967,6 +4967,10 @@ AArch64InstrInfo::getOutliningCandidateInfo( CantGuaranteeValueAcrossCall), RepeatedSequenceLocs.end()); + // If the sequence is empty, we're done. + if (RepeatedSequenceLocs.empty()) + return outliner::OutlinedFunction(); + // At this point, we have only "safe" candidates to outline. Figure out // frame + call instruction information. |