@@ -80,6 +80,13 @@ EnableRescheduling("twoaddr-reschedule",
80
80
cl::desc (" Coalesce copies by rescheduling (default=true)" ),
81
81
cl::init(true ), cl::Hidden);
82
82
83
+ // Limit the number of rescheduling visits to dependent instructions.
84
+ // FIXME: Arbitrary limit to reduce compile time cost.
85
+ static cl::opt<unsigned >
86
+ MaxVisits (" twoaddr-reschedule-visit-limit" , cl::Hidden, cl::init(10 ),
87
+ cl::desc(" Maximum number of rescheduling visits to dependent "
88
+ " instructions (0 = no limit)" ));
89
+
83
90
// Limit the number of dataflow edges to traverse when evaluating the benefit
84
91
// of commuting operands.
85
92
static cl::opt<unsigned > MaxDataFlowEdge (
@@ -994,7 +1001,7 @@ bool TwoAddressInstructionImpl::rescheduleMIBelowKill(
994
1001
// Debug or pseudo instructions cannot be counted against the limit.
995
1002
if (OtherMI.isDebugOrPseudoInstr ())
996
1003
continue ;
997
- if (NumVisited > 10 ) // FIXME: Arbitrary limit to reduce compile time cost.
1004
+ if (MaxVisits && NumVisited > MaxVisits)
998
1005
return false ;
999
1006
++NumVisited;
1000
1007
if (OtherMI.hasUnmodeledSideEffects () || OtherMI.isCall () ||
@@ -1167,7 +1174,7 @@ bool TwoAddressInstructionImpl::rescheduleKillAboveMI(
1167
1174
// Debug or pseudo instructions cannot be counted against the limit.
1168
1175
if (OtherMI.isDebugOrPseudoInstr ())
1169
1176
continue ;
1170
- if (NumVisited > 10 ) // FIXME: Arbitrary limit to reduce compile time cost.
1177
+ if (MaxVisits && NumVisited > MaxVisits)
1171
1178
return false ;
1172
1179
++NumVisited;
1173
1180
if (OtherMI.hasUnmodeledSideEffects () || OtherMI.isCall () ||
0 commit comments