From ba5d5b00b3c34af2a644bdfe24608e21ac2d4eb9 Mon Sep 17 00:00:00 2001 From: Bill Wendling Date: Thu, 29 May 2008 01:02:09 +0000 Subject: Implement "AsCheapAsAMove" for some obviously cheap instructions: xor and the like. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51662 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/TwoAddressInstructionPass.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/TwoAddressInstructionPass.cpp') diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp index 5f0a923f99..81864b7c0e 100644 --- a/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -330,10 +330,13 @@ bool TwoAddressInstructionPass::runOnMachineFunction(MachineFunction &MF) { InstructionRearranged: const TargetRegisterClass* rc = MF.getRegInfo().getRegClass(regA); MachineInstr *Orig = MRI->getVRegDef(regB); + const TargetInstrDesc &OrigTID = Orig->getDesc(); bool SawStore = false; if (EnableReMat && Orig && Orig->isSafeToMove(TII, SawStore) && - TII->isTriviallyReMaterializable(Orig)) { + OrigTID.isAsCheapAsAMove() && !OrigTID.mayLoad() && + !OrigTID.isSimpleLoad()) { + DEBUG(cerr << "2addr: REMATTING : " << *Orig << "\n"); TII->reMaterialize(*mbbi, mi, regA, Orig); ReMattedInstrs.insert(Orig); } else { -- cgit v1.2.3