diff options
author | Tim Northover <tnorthover@apple.com> | 2016-08-29 19:27:20 +0000 |
---|---|---|
committer | Tim Northover <tnorthover@apple.com> | 2016-08-29 19:27:20 +0000 |
commit | ac5148ef41f0bd9ae6d1f18d0f82398162086378 (patch) | |
tree | 8b7728fe3101f332d0daa55cfaff99d764fb5658 /llvm/lib/CodeGen | |
parent | c2ff0eb69762f0c87545b74c89d99cfdbb0913e9 (diff) | |
download | bcm5719-llvm-ac5148ef41f0bd9ae6d1f18d0f82398162086378.tar.gz bcm5719-llvm-ac5148ef41f0bd9ae6d1f18d0f82398162086378.zip |
GlobalISel: switch to SmallVector for pending legalizations.
std::queue was doing far to many heap allocations to be healthy.
llvm-svn: 279992
Diffstat (limited to 'llvm/lib/CodeGen')
-rw-r--r-- | llvm/lib/CodeGen/GlobalISel/MachineLegalizeHelper.cpp | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/MachineLegalizeHelper.cpp b/llvm/lib/CodeGen/GlobalISel/MachineLegalizeHelper.cpp index afc8289640b..9787227d284 100644 --- a/llvm/lib/CodeGen/GlobalISel/MachineLegalizeHelper.cpp +++ b/llvm/lib/CodeGen/GlobalISel/MachineLegalizeHelper.cpp @@ -58,21 +58,23 @@ MachineLegalizeHelper::legalizeInstrStep(MachineInstr &MI, 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(); |