[llvm] r279992 - GlobalISel: switch to SmallVector for pending legalizations.
Tim Northover via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 29 12:27:20 PDT 2016
Author: tnorthover
Date: Mon Aug 29 14:27:20 2016
New Revision: 279992
URL: http://llvm.org/viewvc/llvm-project?rev=279992&view=rev
Log:
GlobalISel: switch to SmallVector for pending legalizations.
std::queue was doing far to many heap allocations to be healthy.
Modified:
llvm/trunk/lib/CodeGen/GlobalISel/MachineLegalizeHelper.cpp
Modified: llvm/trunk/lib/CodeGen/GlobalISel/MachineLegalizeHelper.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/GlobalISel/MachineLegalizeHelper.cpp?rev=279992&r1=279991&r2=279992&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/GlobalISel/MachineLegalizeHelper.cpp (original)
+++ llvm/trunk/lib/CodeGen/GlobalISel/MachineLegalizeHelper.cpp Mon Aug 29 14:27:20 2016
@@ -58,21 +58,23 @@ MachineLegalizeHelper::legalizeInstrStep
MachineLegalizeHelper::LegalizeResult
MachineLegalizeHelper::legalizeInstr(MachineInstr &MI,
const MachineLegalizer &Legalizer) {
- std::queue<MachineInstr *> WorkList;
- MIRBuilder.recordInsertions([&](MachineInstr *MI) { WorkList.push(MI); });
- WorkList.push(&MI);
+ SmallVector<MachineInstr *, 4> WorkList;
+ MIRBuilder.recordInsertions(
+ [&](MachineInstr *MI) { WorkList.push_back(MI); });
+ WorkList.push_back(&MI);
bool Changed = false;
LegalizeResult Res;
+ unsigned Idx = 0;
do {
- Res = legalizeInstrStep(*WorkList.front(), Legalizer);
+ Res = legalizeInstrStep(*WorkList[Idx], Legalizer);
if (Res == UnableToLegalize) {
MIRBuilder.stopRecordingInsertions();
return UnableToLegalize;
}
Changed |= Res == Legalized;
- WorkList.pop();
- } while (!WorkList.empty());
+ ++Idx;
+ } while (Idx < WorkList.size());
MIRBuilder.stopRecordingInsertions();
More information about the llvm-commits
mailing list