From 61b28ede75d9cbd2754a97364b7e99aa60e1b26c Mon Sep 17 00:00:00 2001 From: Ana Pazos Date: Fri, 24 Aug 2018 23:13:59 +0000 Subject: [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 llvm-svn: 340669 --- llvm/lib/Target/RISCV/RISCVFrameLowering.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'llvm/lib') diff --git a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp index a816028f9d8..74417899c8d 100644 --- a/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp +++ b/llvm/lib/Target/RISCV/RISCVFrameLowering.cpp @@ -148,8 +148,7 @@ void RISCVFrameLowering::emitEpilogue(MachineFunction &MF, // 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(); -- cgit v1.2.3