[all-commits] [llvm/llvm-project] b0daac: [CodeGen] Use llvm::bit_ceil (NFC)
kazutakahirata via All-commits
all-commits at lists.llvm.org
Tue Jan 24 22:55:08 PST 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: b0daacf58f417634f7c7c9496589d723592a8f5a
https://github.com/llvm/llvm-project/commit/b0daacf58f417634f7c7c9496589d723592a8f5a
Author: Kazu Hirata <kazu at google.com>
Date: 2023-01-24 (Tue, 24 Jan 2023)
Changed paths:
M clang/lib/CodeGen/SwiftCallingConv.cpp
Log Message:
-----------
[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.
More information about the All-commits
mailing list