aboutsummaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/PostRASchedulerList.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2009-10-02 15:59:52 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2009-10-02 15:59:52 +0000
commite3901ce4809ad26b8173855549cc5adbe7b29b56 (patch)
tree545f72d1e9ca939078a8dda9ef3652313417c8e4 /lib/CodeGen/PostRASchedulerList.cpp
parent30aa6a6b4bc96797d71e8c3cd542973a198124b5 (diff)
downloadexternal_llvm-e3901ce4809ad26b8173855549cc5adbe7b29b56.tar.gz
external_llvm-e3901ce4809ad26b8173855549cc5adbe7b29b56.tar.bz2
external_llvm-e3901ce4809ad26b8173855549cc5adbe7b29b56.zip
Fix a use-after-free in post-ra-scheduling.
MI->addOperand invalidates references to it's operands, avoid touching the operand after a new one was added. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@83249 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/PostRASchedulerList.cpp')
-rw-r--r--lib/CodeGen/PostRASchedulerList.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/CodeGen/PostRASchedulerList.cpp b/lib/CodeGen/PostRASchedulerList.cpp
index 902f50517c..662ab01a37 100644
--- a/lib/CodeGen/PostRASchedulerList.cpp
+++ b/lib/CodeGen/PostRASchedulerList.cpp
@@ -884,6 +884,7 @@ bool SchedulePostRATDList::ToggleKillFlag(MachineInstr *MI,
// If any subreg of MO is live, then create an imp-def for that
// subreg and keep MO marked as killed.
+ MO.setIsKill(false);
bool AllDead = true;
const unsigned SuperReg = MO.getReg();
for (const unsigned *Subreg = TRI->getSubRegisters(SuperReg);
@@ -898,7 +899,8 @@ bool SchedulePostRATDList::ToggleKillFlag(MachineInstr *MI,
}
}
- MO.setIsKill(AllDead);
+ if(AllDead)
+ MO.setIsKill(true);
return false;
}