[PATCH] D153356: [Align] Add isAligned taking an APInt
Guillaume Chatelet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Jun 22 05:03:47 PDT 2023
gchatelet added a comment.
In D153356#4440761 <https://reviews.llvm.org/D153356#4440761>, @arsenm wrote:
> In D153356#4440752 <https://reviews.llvm.org/D153356#4440752>, @gchatelet wrote:
>
>> In D153356#4439433 <https://reviews.llvm.org/D153356#4439433>, @arsenm wrote:
>>
>>> Could also add isAligned to APInt?
>>
>> I believe @nikic is opposed to this as well as it would also add a dependency.
>
> There's no dependency if you just use the raw value instead of the Align wrapper. Also could forward declare Align?
I just checked and it seems that clang is able to optimize out the additional operations
https://godbolt.org/z/G65eKTY3b
Now it's a bit of a bummer to lose the type since you also lose the `isPowerOfTwo` semantic associated with it :-/
That was the original motivation behind `Align`.
Forward declaring wouldn't work as-is because `Log2` takes `Align` by value.
I can try to make it take a const ref instead... let's see.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D153356/new/
https://reviews.llvm.org/D153356
More information about the llvm-commits
mailing list