[llvm] [ConstantFolding] Implement canConstantFoldCallTo() using TLI (PR #221903)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 01:41:57 PDT 2026


================

----------------
nikic wrote:

Both cases should not pass TLI to canConstantFoldCallTo(), because they don't pass TLI to ConstantFoldCall():
https://github.com/llvm/llvm-project/blob/5886c703eb2d205656811d78db82b76524c47da9/llvm/lib/Transforms/IPO/FunctionSpecialization.cpp#L426
https://github.com/llvm/llvm-project/blob/5886c703eb2d205656811d78db82b76524c47da9/llvm/lib/Analysis/InlineCost.cpp#L2429

> Is it possible then to make TLI non-optional, so callers don't forget to pass it?

I think in that case we'd want it to be non-optional on both functions, not just one of them.

https://github.com/llvm/llvm-project/pull/221903


More information about the llvm-commits mailing list