From: Bill Wendling Date: Wed, 28 May 2008 22:52:47 +0000 (+0000) Subject: Check the "isSafeToMove" predicate, which has a series of tests to make sure X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a8db14796b22ba7798ef94fc831d56c8a11d4e2a;p=oota-llvm.git Check the "isSafeToMove" predicate, which has a series of tests to make sure that it's safe to remat an instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51659 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp index 145f80ae74b..5f0a923f996 100644 --- a/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -330,8 +330,10 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) { InstructionRearranged: const TargetRegisterClass* rc = MF.getRegInfo().getRegClass(regA); MachineInstr *Orig = MRI->getVRegDef(regB); + bool SawStore = false; - if (EnableReMat && Orig && TII->isTriviallyReMaterializable(Orig)) { + if (EnableReMat && Orig && Orig->isSafeToMove(TII, SawStore) && + TII->isTriviallyReMaterializable(Orig)) { TII->reMaterialize(*mbbi, mi, regA, Orig); ReMattedInstrs.insert(Orig); } else {