Skip to content

Commit 38b4afb

Browse files
committed
[TwoAddressInstructionPass] Have visit limit be a command line value
1 parent 95ea37c commit 38b4afb

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

llvm/lib/CodeGen/TwoAddressInstructionPass.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@ EnableRescheduling("twoaddr-reschedule",
8080
cl::desc("Coalesce copies by rescheduling (default=true)"),
8181
cl::init(true), cl::Hidden);
8282

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+
8390
// Limit the number of dataflow edges to traverse when evaluating the benefit
8491
// of commuting operands.
8592
static cl::opt<unsigned> MaxDataFlowEdge(
@@ -994,7 +1001,7 @@ bool TwoAddressInstructionImpl::rescheduleMIBelowKill(
9941001
// Debug or pseudo instructions cannot be counted against the limit.
9951002
if (OtherMI.isDebugOrPseudoInstr())
9961003
continue;
997-
if (NumVisited > 10) // FIXME: Arbitrary limit to reduce compile time cost.
1004+
if (MaxVisits && NumVisited > MaxVisits)
9981005
return false;
9991006
++NumVisited;
10001007
if (OtherMI.hasUnmodeledSideEffects() || OtherMI.isCall() ||
@@ -1167,7 +1174,7 @@ bool TwoAddressInstructionImpl::rescheduleKillAboveMI(
11671174
// Debug or pseudo instructions cannot be counted against the limit.
11681175
if (OtherMI.isDebugOrPseudoInstr())
11691176
continue;
1170-
if (NumVisited > 10) // FIXME: Arbitrary limit to reduce compile time cost.
1177+
if (MaxVisits && NumVisited > MaxVisits)
11711178
return false;
11721179
++NumVisited;
11731180
if (OtherMI.hasUnmodeledSideEffects() || OtherMI.isCall() ||

0 commit comments

Comments
 (0)