[llvm] r340669 - [RISCV] Fix std::advance slowness
Ana Pazos via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 24 16:13:59 PDT 2018
Author: apazos
Date: Fri Aug 24 16:13:59 2018
New Revision: 340669
URL: http://llvm.org/viewvc/llvm-project?rev=340669&view=rev
Log:
[RISCV] Fix std::advance slowness
Summary:
It seems std::advance template is treating "-MFI.getCalleeSavedInfo().size()"
as a large unsigned value", causing slowness.
Thanks to Henrik Gustafsson for reporting the issue.
Reviewers: asb
Reviewed By: asb
Subscribers: llvm-commits, rbar, johnrusso, simoncook, sabuasal, niosHD, kito-cheng, shiva0217, zzheng, edward-jones, mgrang, rogfer01, MartinMosbeck, brucehoult, the_o, rkruppe, PkmX, jocewei, asb
Differential Revision: https://reviews.llvm.org/D51148
Modified:
llvm/trunk/lib/Target/RISCV/RISCVFrameLowering.cpp
Modified: llvm/trunk/lib/Target/RISCV/RISCVFrameLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/RISCV/RISCVFrameLowering.cpp?rev=340669&r1=340668&r2=340669&view=diff
==============================================================================
--- llvm/trunk/lib/Target/RISCV/RISCVFrameLowering.cpp (original)
+++ llvm/trunk/lib/Target/RISCV/RISCVFrameLowering.cpp Fri Aug 24 16:13:59 2018
@@ -148,8 +148,7 @@ void RISCVFrameLowering::emitEpilogue(Ma
// Skip to before the restores of callee-saved registers
// FIXME: assumes exactly one instruction is used to restore each
// callee-saved register.
- MachineBasicBlock::iterator LastFrameDestroy = MBBI;
- std::advance(LastFrameDestroy, -MFI.getCalleeSavedInfo().size());
+ auto LastFrameDestroy = std::prev(MBBI, MFI.getCalleeSavedInfo().size());
uint64_t StackSize = MFI.getStackSize();
More information about the llvm-commits
mailing list