From: Evan Cheng Date: Fri, 8 Oct 2010 18:42:25 +0000 (+0000) Subject: Fix operand latency computation in cases where the definition operand is X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=1aca5bc1353d4e2c7706149efbc5393aa9e2cc3f;p=oota-llvm.git Fix operand latency computation in cases where the definition operand is implicit. e.g. %D6, %D7 = VLD1q16 %R2, 0, ..., %Q3 %Q1 = VMULv8i16 %Q1, %Q3, ... The real definition indices are 0,1. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@116080 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/ScheduleDAGInstrs.cpp b/lib/CodeGen/ScheduleDAGInstrs.cpp index bf68c0eeb90..c0fa9ddb46d 100644 --- a/lib/CodeGen/ScheduleDAGInstrs.cpp +++ b/lib/CodeGen/ScheduleDAGInstrs.cpp @@ -527,6 +527,17 @@ void ScheduleDAGInstrs::ComputeOperandLatency(SUnit *Def, SUnit *Use, MachineInstr *DefMI = Def->getInstr(); int DefIdx = DefMI->findRegisterDefOperandIdx(Reg); if (DefIdx != -1) { + const MachineOperand &MO = DefMI->getOperand(DefIdx); + if (MO.isReg() && MO.isImplicit() && + DefIdx >= DefMI->getDesc().getNumOperands()) { + // This is an implicit def, getOperandLatency() won't return the correct + // latency. e.g. + // %D6, %D7 = VLD1q16 %R2, 0, ..., %Q3 + // %Q1 = VMULv8i16 %Q1, %Q3, ... + // What we want is to compute latency between def of %D6/%D7 and use of + // %Q3 instead. + DefIdx = DefMI->findRegisterDefOperandIdx(Reg, false, true, TRI); + } MachineInstr *UseMI = Use->getInstr(); // For all uses of the register, calculate the maxmimum latency int Latency = -1;