Skip to content

Commit d89f2d8

Browse files
committed
[Analysis] Allow -scalar-evolution-max-iterations more than once
At present, `-scalar-evolution-max-iterations` is a `cl::Optional` option, which means it demands to be passed exactly zero or one times. Our build system makes it pretty tricky to guarantee this. We often accidentally pass the flag more than once (but always with the same value) which results in an error, after which compilation fails: ``` clang (LLVM option parsing): for the -scalar-evolution-max-iterations option: may only occur zero or one times! ``` It seems reasonable to allow -scalar-evolution-max-iterations to be passed more than once. Quoting the [[ http://llvm.org/docs/CommandLine.html#controlling-the-number-of-occurrences-required-and-allowed | documentation ]]: > The cl::ZeroOrMore modifier ... indicates that your program will allow the option to be specified zero or more times. > ... > If an option is specified multiple times for an option of the cl::opt class, only the last value will be retained. Original patch by: Enrico Bern Hardy Tanuwidjaja <[email protected]> Differential Revision: https://reviews.llvm.org/D67512 llvm-svn: 372346
1 parent ca4c5de commit d89f2d8

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

llvm/lib/Analysis/ScalarEvolution.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ STATISTIC(NumBruteForceTripCountsComputed,
148148

149149
static cl::opt<unsigned>
150150
MaxBruteForceIterations("scalar-evolution-max-iterations", cl::ReallyHidden,
151+
cl::ZeroOrMore,
151152
cl::desc("Maximum number of iterations SCEV will "
152153
"symbolically execute a constant "
153154
"derived loop"),
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
; Ensure we can pass -scalar-evolution-max-iterations multiple times
2+
; RUN: opt -S -scalar-evolution -scalar-evolution-max-iterations=42 -scalar-evolution-max-iterations=42 < %s

0 commit comments

Comments
 (0)