Hoisting invariant assertions to the top
Details
Details
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Comment Actions
Unfortunately, the const in the method signature is required to be certain that the assertion in the while-loop is indeed entailed. We can safely remove it, but then the compiler wouldn't warn someone who tries to make a change that would break the entailment (i.e., by actually mutating hi).
Comment Actions
That makes sense, but I am not sure if our style guidelines allow the const on scalars. I would just remove it to be safe, although I agree with your reasoning (in fact, in former projects, we put const on pretty much everything that would allow it ;-)