@@ -214,6 +214,14 @@ void ScheduleDAGInstrs::addSchedBarrierDeps() {
214
214
unsigned OpIdx = MO.getOperandNo ();
215
215
Register Reg = MO.getReg ();
216
216
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.
217
225
bool IsRealUse = OpIdx < MIDesc.getNumOperands () ||
218
226
MIDesc.hasImplicitUseOfPhysReg (Reg);
219
227
for (MCRegUnit Unit : TRI->regunits (Reg))
@@ -267,6 +275,9 @@ void ScheduleDAGInstrs::addPhysRegDataDeps(SUnit *SU, unsigned OperIdx) {
267
275
bool ImplicitPseudoUse = false ;
268
276
SDep Dep;
269
277
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.
270
281
Dep = SDep (SU, SDep::Artificial);
271
282
} else {
272
283
// Set the hasPhysRegDefs only for physreg defs that have a use within
0 commit comments