aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineOutliner.cpp
diff options
context:
space:
mode:
authorJessica Paquette <jpaquette@apple.com>2018-07-27 18:21:57 +0000
committerJessica Paquette <jpaquette@apple.com>2018-07-27 18:21:57 +0000
commit9d93c6026a61507db25e8615d82a2576bdc8b319 (patch)
tree5e224cb511db3f64b7223560fd40ef18310e80e4 /llvm/lib/CodeGen/MachineOutliner.cpp
parentfcca45f0ddb94947009615029bfd480e649abd64 (diff)
downloadllvm-9d93c6026a61507db25e8615d82a2576bdc8b319.zip
llvm-9d93c6026a61507db25e8615d82a2576bdc8b319.tar.gz
llvm-9d93c6026a61507db25e8615d82a2576bdc8b319.tar.bz2
[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/CodeGen/MachineOutliner.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineOutliner.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/MachineOutliner.cpp b/llvm/lib/CodeGen/MachineOutliner.cpp
index 1babe42..28e4e2c 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]);