Delay initialization of OptBisect
authorKrzysztof Parzyszek <kparzysz@quicinc.com>
Fri, 18 Jun 2021 17:24:03 +0000 (12:24 -0500)
committerKrzysztof Parzyszek <kparzysz@quicinc.com>
Fri, 18 Jun 2021 18:15:19 +0000 (13:15 -0500)
commitec91df8d8195b8b759a89734dba227da1eaa729f
tree66ab0a056ab4d66f54908b6296199acb7d4b7080
parent5c189d30e60ac044b5bb473648c5505b4acdeb08
Delay initialization of OptBisect

When LLVM is used in other projects, it may happen that global cons-
tructors will execute before the call to ParseCommandLineOptions.
Since OptBisect is initialized via a constructor, and has no ability
to be updated at a later time, passing "-opt-bisect-limit" to the
parse function may have no effect.

To avoid this problem use a cl::cb (callback) to set the bisection
limit when the option is actually processed.

Differential Revision: https://reviews.llvm.org/D104551
llvm/include/llvm/IR/OptBisect.h
llvm/lib/IR/OptBisect.cpp