Handle integer constants up front
The compiler now directly returns an integer constant value when `get_maxval_strlen` is passed an integer constant.
When get_maxval_strlen is called with an integer constant, it now directly returns that constant value rather than performing unnecessary calculations. This simplifies the code and might give a very slight performance increase in some constant-heavy code.
In Details
This commit changes get_maxval_strlen in gimple-fold.cc to return immediately if passed a constant. get_maxval_strlen is used during Gimple folding, a GCC optimization pass. This avoids redundant computation involved in determining the maximum length of a string when the length is already known at compile time. This is a minor optimization.
For Context
Compilers often perform optimizations by evaluating expressions at compile time rather than runtime. This commit optimizes a specific case where the maximum length of a string can be determined at compile time because it's a constant. By handling this case directly, the compiler avoids doing extra work and can generate slightly faster code.