Skip to content

Commit 8b87e2f

Browse files
committed
Comment the check
1 parent 05cca1b commit 8b87e2f

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
@@ -214,6 +214,14 @@ void ScheduleDAGInstrs::addSchedBarrierDeps() {
214214
unsigned OpIdx = MO.getOperandNo();
215215
Register Reg = MO.getReg();
216216
if (Reg.isPhysical()) {
217+
// addPhysRegDataDeps uses the provided operand index to retrieve
218+
// the operand use cycle from the scheduling model. If the operand
219+
// is "fake" (e.g., an operand of a call instruction used to pass
220+
// an argument to the called function.), the scheduling model may not
221+
// have an entry for it. If this is the case, pass -1 as operand index,
222+
// which will cause addPhysRegDataDeps to add an artificial dependency.
223+
// FIXME: Using hasImplicitUseOfPhysReg here is inaccurate as it misses
224+
// aliases. When fixing, make sure to update addPhysRegDataDeps, too.
217225
bool IsRealUse = OpIdx < MIDesc.getNumOperands() ||
218226
MIDesc.hasImplicitUseOfPhysReg(Reg);
219227
for (MCRegUnit Unit : TRI->regunits(Reg))
@@ -267,6 +275,9 @@ void ScheduleDAGInstrs::addPhysRegDataDeps(SUnit *SU, unsigned OperIdx) {
267275
bool ImplicitPseudoUse = false;
268276
SDep Dep;
269277
if (UseOpIdx < 0) {
278+
// FIXME: UseOpIdx can be passed to computeOperandLatency, which can
279+
// pass it to findUseIdx, which treats it as unsigned. If this is
280+
// the expected behavior, it should be commented.
270281
Dep = SDep(SU, SDep::Artificial);
271282
} else {
272283
// Set the hasPhysRegDefs only for physreg defs that have a use within

0 commit comments

Comments
 (0)