[llvm] [InstCombine] Handle ceil division idiom (PR #100977)

Antonio Frighetto via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 27 06:58:16 PDT 2024


antoniofrighetto wrote:

> The key one is probably this in DataLayout:
> 
> ```
>   TypeSize getTypeStoreSize(Type *Ty) const {
>     TypeSize BaseSize = getTypeSizeInBits(Ty);
>     return {divideCeil(BaseSize.getKnownMinValue(), 8), BaseSize.isScalable()};
>   }
> ```
> 
> This works on uint64_t and nothing tells us that it will not overflow :(

Would it make sense by any chance to change `divideCeil` to somehow take into account when we know it will not overflow? It seems there are a handful of such cases.

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


More information about the llvm-commits mailing list