summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/VirtRegMap.cpp
diff options
context:
space:
mode:
authorMatthias Braun <matze@braunis.de>2017-03-21 21:58:08 +0000
committerMatthias Braun <matze@braunis.de>2017-03-21 21:58:08 +0000
commit8445cbd1ca964ff490268e0854ecafaf97718639 (patch)
tree0a2f4ecd4bab006b0dda7f1c69a9f2c0bd0f14de /llvm/lib/CodeGen/VirtRegMap.cpp
parentfc16173cebfb61c13319d6ebada3bb2c4fad14e7 (diff)
downloadbcm5719-llvm-8445cbd1ca964ff490268e0854ecafaf97718639.tar.gz
bcm5719-llvm-8445cbd1ca964ff490268e0854ecafaf97718639.zip
SplitKit: Fix subreg copy related problems
Fix two problems related to r298025: - SplitKit would create duplicate VNIs in some cases leading to crashs when hoisting copies. - VirtRegMap could fail expanding copies at the beginning of a basic block. This fixes http://llvm.org/PR32353 llvm-svn: 298448
Diffstat (limited to 'llvm/lib/CodeGen/VirtRegMap.cpp')
-rw-r--r--llvm/lib/CodeGen/VirtRegMap.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/VirtRegMap.cpp b/llvm/lib/CodeGen/VirtRegMap.cpp
index 06a97fd6d4d..c8946010e9d 100644
--- a/llvm/lib/CodeGen/VirtRegMap.cpp
+++ b/llvm/lib/CodeGen/VirtRegMap.cpp
@@ -383,8 +383,10 @@ void VirtRegRewriter::expandCopyBundle(MachineInstr &MI) const {
if (MI.isBundledWithPred() && !MI.isBundledWithSucc()) {
// Only do this when the complete bundle is made out of COPYs.
+ MachineBasicBlock &MBB = *MI.getParent();
for (MachineBasicBlock::reverse_instr_iterator I =
- std::next(MI.getReverseIterator()); I->isBundledWithSucc(); ++I) {
+ std::next(MI.getReverseIterator()), E = MBB.instr_rend();
+ I != E && I->isBundledWithSucc(); ++I) {
if (!I->isCopy())
return;
}
OpenPOWER on IntegriCloud