Skip to content

Commit 8c5e7e5

Browse files
author
Evan Cheng
committed
Fix operand latency computation in cases where the definition operand is
implicit. e.g. %D6<def>, %D7<def> = VLD1q16 %R2<kill>, 0, ..., %Q3<imp-def> %Q1<def> = VMULv8i16 %Q1<kill>, %Q3<kill>, ... The real definition indices are 0,1. llvm-svn: 116080
1 parent cc0e18d commit 8c5e7e5

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

llvm/lib/CodeGen/ScheduleDAGInstrs.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,17 @@ void ScheduleDAGInstrs::ComputeOperandLatency(SUnit *Def, SUnit *Use,
527527
MachineInstr *DefMI = Def->getInstr();
528528
int DefIdx = DefMI->findRegisterDefOperandIdx(Reg);
529529
if (DefIdx != -1) {
530+
const MachineOperand &MO = DefMI->getOperand(DefIdx);
531+
if (MO.isReg() && MO.isImplicit() &&
532+
DefIdx >= DefMI->getDesc().getNumOperands()) {
533+
// This is an implicit def, getOperandLatency() won't return the correct
534+
// latency. e.g.
535+
// %D6<def>, %D7<def> = VLD1q16 %R2<kill>, 0, ..., %Q3<imp-def>
536+
// %Q1<def> = VMULv8i16 %Q1<kill>, %Q3<kill>, ...
537+
// What we want is to compute latency between def of %D6/%D7 and use of
538+
// %Q3 instead.
539+
DefIdx = DefMI->findRegisterDefOperandIdx(Reg, false, true, TRI);
540+
}
530541
MachineInstr *UseMI = Use->getInstr();
531542
// For all uses of the register, calculate the maxmimum latency
532543
int Latency = -1;

0 commit comments

Comments
 (0)