[CodeGen] Use llvm::bit_ceil (NFC)
authorKazu Hirata <kazu@google.com>
Wed, 25 Jan 2023 06:54:53 +0000 (22:54 -0800)
committerKazu Hirata <kazu@google.com>
Wed, 25 Jan 2023 06:54:53 +0000 (22:54 -0800)
commitb0daacf58f417634f7c7c9496589d723592a8f5a
treead065179d691a13c657e379c982b6f5fa282a403
parentd5248a46faed9071adffc65f82cac9bc0769b882
[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.
clang/lib/CodeGen/SwiftCallingConv.cpp