diff options
| author | Roman Tereshin <rtereshin@apple.com> | 2018-05-08 22:53:09 +0000 |
|---|---|---|
| committer | Roman Tereshin <rtereshin@apple.com> | 2018-05-08 22:53:09 +0000 |
| commit | 25cbfe680ef01db07e4ef44849fe73177197363b (patch) | |
| tree | 8cdb92127a65ccf5d99076314c9f8654951b2505 /llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp | |
| parent | cdb50bc93bb4cabc5b491e0f8024a67bd200ea71 (diff) | |
| download | llvm-25cbfe680ef01db07e4ef44849fe73177197363b.zip llvm-25cbfe680ef01db07e4ef44849fe73177197363b.tar.gz llvm-25cbfe680ef01db07e4ef44849fe73177197363b.tar.bz2 | |
[GlobalISel][Legalizer] More concise and faster widenScalar, NFC
Refactoring LegalizerHelper::widenScalar member function reducing its
size by approximately a factor of 2 and (hopefuly) making it more
straightforward and regular by introducing widenScalarSrc and
widenScalarDst helper methods.
The new widenScalar* methods mutate the instructions in place instead
of recreating them from scratch and removing the originals. The
compile time implications of this were measured on sqlite3
amalgamation, targeting AArch64 in -O0:
LegalizerHelper::widenScalar: > 25% faster
Legalizer::runOnMachineFunction: ~ 4.0 - 4.5% faster
Also adding MachineOperand::setCImm and refactoring out
MachineIRBuilder::recordInsertion methods to make the change possible.
Reviewers: aditya_nandakumar, bogner, javed.absar, t.p.northover, ab, dsanders, arsenm
Reviewed By: aditya_nandakumar
Subscribers: wdng, rovka, kristof.beyls, llvm-commits
Differential Revision: https://reviews.llvm.org/D46414
llvm-svn: 331819
Diffstat (limited to 'llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp')
| -rw-r--r-- | llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp b/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp index 273044b..a3bf45f 100644 --- a/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp +++ b/llvm/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp @@ -53,6 +53,11 @@ void MachineIRBuilderBase::setInsertPt(MachineBasicBlock &MBB, State.II = II; } +void MachineIRBuilderBase::recordInsertion(MachineInstr *InsertedInstr) const { + if (State.InsertedInstr) + State.InsertedInstr(InsertedInstr); +} + void MachineIRBuilderBase::recordInsertions( std::function<void(MachineInstr *)> Inserted) { State.InsertedInstr = std::move(Inserted); @@ -77,8 +82,7 @@ MachineInstrBuilder MachineIRBuilderBase::buildInstrNoInsert(unsigned Opcode) { MachineInstrBuilder MachineIRBuilderBase::insertInstr(MachineInstrBuilder MIB) { getMBB().insert(getInsertPt(), MIB); - if (State.InsertedInstr) - State.InsertedInstr(MIB); + recordInsertion(MIB); return MIB; } |
