summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorAna Pazos <apazos@codeaurora.org>2018-08-24 23:13:59 +0000
committerAna Pazos <apazos@codeaurora.org>2018-08-24 23:13:59 +0000
commit61b28ede75d9cbd2754a97364b7e99aa60e1b26c (patch)
treedfc406555219933eeedb437255f6ed6878b0a853 /llvm/lib
parent673412e3faac59fc3a3fcf58fa2ae2cef82d18ee (diff)
downloadbcm5719-llvm-61b28ede75d9cbd2754a97364b7e99aa60e1b26c.tar.gz
bcm5719-llvm-61b28ede75d9cbd2754a97364b7e99aa60e1b26c.zip
[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
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/RISCV/RISCVFrameLowering.cpp3
1 files changed, 1 insertions, 2 deletions
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();
OpenPOWER on IntegriCloud