Optimize constant arithmetic
Open
area-perf
area-query
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
Some function translations apply arithmetic to arguments/return values; when the operands happen to be constants, we can simply compute the result in post-translation and embed the result constant.
See #28031 for an example with SQL Server's string.IndexOf.
It may be a good idea to do some non-arithmatic evaluation as well (IIRC there's some logical optimization happening in SqlNullabilityProcessor, which may make more sense in a general optimizing visitor or something).
Contributor guide
Assessment
This issue has not been assessed yet.