[llvm] Redundant Assert In AsmWriter (PR #129288)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 28 13:27:24 PST 2025


https://github.com/nikic commented:

> The assert in GetConstant checks if Bound is constant. However, GetConstant is only called when IsConstant==true.

Yes -- and the assert ensures that GetConstant is only used in cases where it is valid.

I think if you want to change this code, the better change would be to drop IsConstant and instead have GetConstant return an std::optional. Then you don't need separate IsConstant and GetConstant calls.

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


More information about the llvm-commits mailing list