Before this commit, `MakeEnvNullPass` was substituting uses of `env`
with uses of `nullptr`.
This operation was introducing undefined behavior, and subsequent
optimizations were allowed to mark BasicBlocks where it occured as
unreachable, eventually leading to their wrong removal.
This commit fixes the substitution, properly replacing loads from `env`
with `nullptr`.
This should never cause undefined behavior anymore, because the results
from load from `env` is never referenced in isolated functions.
This assertion was executed in the `runOnModule` method of the GCBI
pass, but it is too strict.
Asserting that Dispatcher != nullptr during the execution of the pass
prevents the pass from successfully running on a Module without a
Dispatcher.
This is unfortunate, because some passes that depend on GCBI in revng-c
actually do that. They do so because they are not really interested in
the Dispatcher at all. They only use GCBI to access information on the
Stack Pointer.
In fact, the check for Dispatcher being != from nullptr is already
performed also in the `dispatcher()` method which is the sane thing to
do. This commit removes the assertion from the `runOnModule` method and
leaves it in the `dispatcher` method.
This allows to run the pass successfully even on a Module without the
Dispatcher, while not changing the contract of this pass (i.e. that when
you call the `dispatcher` method you get a nonnull pointer).
- Use uint32_t
- Define Top as uin32_t max
- Fix copyright notice
- Use using namespace llvm in cpp files
- Change hasSideEffects to isDataFlowSink
- Outline isAddLike
- Add option to ignore certain analysis results
This commits adds two passes
- FilterForDecompilationFunctionPass deletes the body of a Function if
it's not a isolated function produced by revng
- FilterForDecompilationModulePass deletes all the bodies of the
functions that are not isolated functions generated by revng
These passes are used at the beginning of the decompilation pipeline, to
prevent all the passes of the decompilation pipeline to run on root and
other big functions coming from QEMU that do not need to be decompiled.
This fixes an issue causing crashes when calling the public API
`decompileFunction`, that was internally adding a `MakeEnvNullPass`
(formerly a `ModulePass`) to a `FunctionPassManager.