diff options
author | Pablo Barrio <pablo.barrio@arm.com> | 2016-08-26 13:00:39 +0000 |
---|---|---|
committer | Pablo Barrio <pablo.barrio@arm.com> | 2016-08-26 13:00:39 +0000 |
commit | b8ec6305835c3dab8e3de2224840bd404b982e89 (patch) | |
tree | 00ac96be597c477b70d460f5b3bbc658386bc447 /llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp | |
parent | fdb0f39ae27e41116b0cb1dc81af608b3b39df29 (diff) | |
download | llvm-b8ec6305835c3dab8e3de2224840bd404b982e89.zip llvm-b8ec6305835c3dab8e3de2224840bd404b982e89.tar.gz llvm-b8ec6305835c3dab8e3de2224840bd404b982e89.tar.bz2 |
Handle empty functions with debug info in load/store opt pass
Summary:
In fuctions that contained debug info but were empty otherwise,
the ARM load/store optimizer could abort. This was because
function MergeReturnIntoLDM handled the special case where a
Machine Basic BLock is empty by calling MBB.empty(). However, this
returns false in presence of debug info, although the function
should be considered empty in the eyes of the load/store optimizer.
This has been fixed by handling the case where searching through the
block finds only debug instructions.
Reviewers: rengolin, dexonsmith, llvm-commits, jmolloy
Subscribers: t.p.northover, aemerson, rengolin, samparker
Differential Revision: https://reviews.llvm.org/D23847
llvm-svn: 279820
Diffstat (limited to 'llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp')
-rw-r--r-- | llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp b/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp index fff6c0e..375a8b5 100644 --- a/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp +++ b/llvm/lib/Target/ARM/ARMLoadStoreOptimizer.cpp @@ -1851,7 +1851,7 @@ bool ARMLoadStoreOpt::MergeReturnIntoLDM(MachineBasicBlock &MBB) { if (MBB.empty()) return false; MachineBasicBlock::iterator MBBI = MBB.getLastNonDebugInstr(); - if (MBBI != MBB.begin() && + if (MBBI != MBB.begin() && MBBI != MBB.end() && (MBBI->getOpcode() == ARM::BX_RET || MBBI->getOpcode() == ARM::tBX_RET || MBBI->getOpcode() == ARM::MOVPCLR)) { |