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

Ramkumar Ramachandra via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 8 01:04:36 PDT 2026


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

----------------
artagnon wrote:

Also InlineCost, I think?

```cpp
bool CallAnalyzer::simplifyCallSite(Function *F, CallBase &Call) {
  // FIXME: Using the instsimplify logic directly for this is inefficient
  // because we have to continually rebuild the argument list even when no
  // simplifications can be performed. Until that is fixed with remapping
  // inside of instsimplify, directly constant fold calls here.
  if (!canConstantFoldCallTo(&Call, F))
    return false;
```

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


More information about the llvm-commits mailing list