Skip to content
Commit b0daacf5 authored by Kazu Hirata's avatar Kazu Hirata
Browse files

[CodeGen] Use llvm::bit_ceil (NFC)

If we know that x is nonzero and not a power of 2, then
llvm::findLastSet(x) + 1 is the index of the bit just above the
highest set bit in x.  That is, 1 << (llvm::findLastSet(x) + 1) is the
same as llvm::bit_ceil(x).

Since llvm::bit_ceil is a nop on a power of 2, we can unconditionally
call llvm::bit_ceil.  The end result actually matches the comment.
parent d5248a46
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment