niyue opened a new pull request, #40031: URL: https://github.com/apache/arrow/pull/40031
### Rationale for this change This PR tries to address GH-40024. It keeps track of used functions in Gandiva expressions, and uses that information to avoid defining unused C functions in LLVM module, and avoid loading/linking the LLVM bitcode if no LLVM IR function is used in the expressions. And this helps expression compilation performance. ### What changes are included in this PR? * `ExprDecomposer` has a new member called `used_functions_` to keep track of used functions after visiting the expressions. * `Engine`'s `Init` process is postponed to after all expressions are decomposed, so that all functions used can be obtained before constructing LLVM modules. * `AddGlobalMappingForFunc` only for used functions * Separate LLVM bitcode (`irhelpers.bc`) into two parts, one for mandatory bitcode, and the other for optional bitcode. * Load bitcode only when necessary ### Are these changes tested? * Yes, several unit tests are added to cover these changes. * And several micro benchmarks are added to verify the performance change. ### Are there any user-facing changes? No -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
