[llvm] r338148 - [MachineOutliner] Exit getOutliningCandidateInfo when we erase all candidates
Jessica Paquette via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 27 11:21:58 PDT 2018
Author: paquette
Date: Fri Jul 27 11:21:57 2018
New Revision: 338148
URL: http://llvm.org/viewvc/llvm-project?rev=338148&view=rev
Log:
[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.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineOutliner.h
llvm/trunk/lib/CodeGen/MachineOutliner.cpp
llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineOutliner.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineOutliner.h?rev=338148&r1=338147&r2=338148&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineOutliner.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineOutliner.h Fri Jul 27 11:21:57 2018
@@ -217,6 +217,8 @@ public:
for (std::shared_ptr<Candidate> &C : Candidates)
C->Benefit = B;
}
+
+ OutlinedFunction() {}
};
} // namespace outliner
} // namespace llvm
Modified: llvm/trunk/lib/CodeGen/MachineOutliner.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/MachineOutliner.cpp?rev=338148&r1=338147&r2=338148&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/MachineOutliner.cpp (original)
+++ llvm/trunk/lib/CodeGen/MachineOutliner.cpp Fri Jul 27 11:21:57 2018
@@ -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]);
Modified: llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp?rev=338148&r1=338147&r2=338148&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64InstrInfo.cpp Fri Jul 27 11:21:57 2018
@@ -4967,6 +4967,10 @@ AArch64InstrInfo::getOutliningCandidateI
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.
More information about the llvm-commits
mailing list