diff options
| author | Dan Gohman <gohman@apple.com> | 2009-10-30 22:18:41 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2009-10-30 22:18:41 +0000 |
| commit | 0115e164bad632572e2cfbaf72f0f0882d5319de (patch) | |
| tree | e1e3d79537c4854d8ab8a456330534a5fe807054 /lib/CodeGen/MachineLICM.cpp | |
| parent | 287db0c23c9188c563cc2ff449733f233535496e (diff) | |
Fix MachineLICM to use the correct virtual register class when
unfolding loads for hoisting. getOpcodeAfterMemoryUnfold returns the
opcode of the original operation without the load, not the load
itself, MachineLICM needs to know the operand index in order to get
the correct register class. Extend getOpcodeAfterMemoryUnfold to
return this information.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85622 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/MachineLICM.cpp')
| -rw-r--r-- | lib/CodeGen/MachineLICM.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/CodeGen/MachineLICM.cpp b/lib/CodeGen/MachineLICM.cpp index 5ab0ff745d..7b64047c39 100644 --- a/lib/CodeGen/MachineLICM.cpp +++ b/lib/CodeGen/MachineLICM.cpp @@ -392,14 +392,16 @@ MachineInstr *MachineLICM::ExtractHoistableLoad(MachineInstr *MI) { if (!AA->pointsToConstantMemory(MMO->getValue())) return 0; } // Next determine the register class for a temporary register. + unsigned LoadRegIndex; unsigned NewOpc = TII->getOpcodeAfterMemoryUnfold(MI->getOpcode(), /*UnfoldLoad=*/true, - /*UnfoldStore=*/false); + /*UnfoldStore=*/false, + &LoadRegIndex); if (NewOpc == 0) return 0; const TargetInstrDesc &TID = TII->get(NewOpc); if (TID.getNumDefs() != 1) return 0; - const TargetRegisterClass *RC = TID.OpInfo[0].getRegClass(TRI); + const TargetRegisterClass *RC = TID.OpInfo[LoadRegIndex].getRegClass(TRI); // Ok, we're unfolding. Create a temporary register and do the unfold. unsigned Reg = RegInfo->createVirtualRegister(RC); SmallVector<MachineInstr *, 2> NewMIs; |
