[clang] 7a063c1 - [AST] Use llvm::bit_ceil (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Sun Jan 29 15:39:52 PST 2023


Author: Kazu Hirata
Date: 2023-01-29T15:39:46-08:00
New Revision: 7a063c1a13b209425ef1611a5f08e2c500ac7f30

URL: https://github.com/llvm/llvm-project/commit/7a063c1a13b209425ef1611a5f08e2c500ac7f30
DIFF: https://github.com/llvm/llvm-project/commit/7a063c1a13b209425ef1611a5f08e2c500ac7f30.diff

LOG: [AST] Use llvm::bit_ceil (NFC)

For nonzero X that is not a power of 2, NextPowerOf2(X) is equivalent
to llvm::bit_ceil(X).

Added: 
    

Modified: 
    clang/lib/AST/ASTContext.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index aff3dec118dc..5976ada29a86 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -2084,7 +2084,7 @@ TypeInfo ASTContext::getTypeInfoImpl(const Type *T) const {
     // If the alignment is not a power of 2, round up to the next power of 2.
     // This happens for non-power-of-2 length vectors.
     if (Align & (Align-1)) {
-      Align = llvm::NextPowerOf2(Align);
+      Align = llvm::bit_ceil(Align);
       Width = llvm::alignTo(Width, Align);
     }
     // Adjust the alignment based on the target max.


        


More information about the cfe-commits mailing list