From fb018d0433f7b52c3f1235e675276adb1f92d597 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Wed, 20 Aug 2008 20:32:05 +0000 Subject: [PATCH] Don't hoist instructions that define a physical register. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@55074 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/MachineLICM.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/CodeGen/MachineLICM.cpp b/lib/CodeGen/MachineLICM.cpp index 302581f4dd5..1ec32b53365 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();