From 98ec91ea80e042907aac8d3cbd9614d29f6cba45 Mon Sep 17 00:00:00 2001 From: Evan Cheng Date: Fri, 2 Jul 2010 20:36:18 +0000 Subject: - Two-address pass should not assume unfolding is always successful. - X86 unfolding should check if the instructions being unfolded has memoperands. If there is no memoperands, then it must assume conservative alignment. If this would introduce an expensive sse unaligned load / store, then unfoldMemoryOperand etc. should not unfold the instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@107509 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/TwoAddressInstructionPass.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'lib/CodeGen/TwoAddressInstructionPass.cpp') diff --git a/lib/CodeGen/TwoAddressInstructionPass.cpp b/lib/CodeGen/TwoAddressInstructionPass.cpp index 0c97dad48b..62fa0fdb77 100644 --- a/lib/CodeGen/TwoAddressInstructionPass.cpp +++ b/lib/CodeGen/TwoAddressInstructionPass.cpp @@ -926,14 +926,12 @@ TryInstructionTransform(MachineBasicBlock::iterator &mi, UnfoldTID.OpInfo[LoadRegIndex].getRegClass(TRI); unsigned Reg = MRI->createVirtualRegister(RC); SmallVector NewMIs; - bool Success = - TII->unfoldMemoryOperand(MF, mi, Reg, - /*UnfoldLoad=*/true, /*UnfoldStore=*/false, - NewMIs); - (void)Success; - assert(Success && - "unfoldMemoryOperand failed when getOpcodeAfterMemoryUnfold " - "succeeded!"); + if (!TII->unfoldMemoryOperand(MF, mi, Reg, + /*UnfoldLoad=*/true,/*UnfoldStore=*/false, + NewMIs)) { + DEBUG(dbgs() << "2addr: ABANDONING UNFOLD\n"); + return false; + } assert(NewMIs.size() == 2 && "Unfolded a load into multiple instructions!"); // The load was previously folded, so this is the only use. -- cgit v1.2.3