aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/CodeGen/MachineLICM.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/CodeGen/MachineLICM.cpp b/lib/CodeGen/MachineLICM.cpp
index 302581f4dd..1ec32b5336 100644
--- a/lib/CodeGen/MachineLICM.cpp
+++ b/lib/CodeGen/MachineLICM.cpp
@@ -273,7 +273,14 @@ bool MachineLICM::IsLoopInvariantInst(MachineInstr &I) {
for (unsigned i = 0, e = I.getNumOperands(); i != e; ++i) {
const MachineOperand &MO = I.getOperand(i);
- if (!MO.isRegister() || !MO.isUse())
+ if (!MO.isRegister())
+ continue;
+
+ if (MO.isDef() && TargetRegisterInfo::isPhysicalRegister(MO.getReg()))
+ // Don't hoist an instruction that defines a physical register.
+ return false;
+
+ if (!MO.isUse())
continue;
unsigned Reg = MO.getReg();