[llvm] [llvm] Make charset constexpr (NFC) (PR #137535)

Aaron Gokaslan via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 28 08:19:01 PDT 2025


Skylion007 wrote:

> LLVM generally does not use const for local variables, let alone constexpr.
> 
> If there were some specific reason to do this (e.g. to force constexpr evaluation of an initializer) that would be one thing, but just adding a constexpr to essentially a single random variable in a large code base doesn't make a lot of sense to me.

Main motivation is better static analysis as some tools can detect OOB axes or make better optimizer decision by knowing the address of the memory ahead of time. I see marginal maintainability and code style benefits from doing so. I agree a single change like this might not mean much, but I have caught index axis bugs with static analyzers by doing this before at the very least.

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


More information about the llvm-commits mailing list