Don't hoist instructions that define a physical register.
authorBill Wendling <isanbard@gmail.com>
Wed, 20 Aug 2008 20:32:05 +0000 (20:32 +0000)
committerBill Wendling <isanbard@gmail.com>
Wed, 20 Aug 2008 20:32:05 +0000 (20:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55074 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/MachineLICM.cpp

index 302581f4dd516c329b3bfaf3292a32ffae123441..1ec32b533650b9f2a8a5a05608f16232f82675ff 100644 (file)
@@ -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();