[llvm] 5816134 - Make Value::MaxAlignment(Exponent) constexpr
    Alex Richardson via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Thu Aug 26 02:10:05 PDT 2021
    
    
  
Author: Alex Richardson
Date: 2021-08-26T10:09:40+01:00
New Revision: 581613413c273012747676d9b0f0970cc26d5683
URL: https://github.com/llvm/llvm-project/commit/581613413c273012747676d9b0f0970cc26d5683
DIFF: https://github.com/llvm/llvm-project/commit/581613413c273012747676d9b0f0970cc26d5683.diff
LOG: Make Value::MaxAlignment(Exponent) constexpr
This avoids references to the variables be generated when using e.g. max().
Reviewed By: dexonsmith
Differential Revision: https://reviews.llvm.org/D95050
Added: 
    
Modified: 
    llvm/include/llvm/IR/Value.h
Removed: 
    
################################################################################
diff  --git a/llvm/include/llvm/IR/Value.h b/llvm/include/llvm/IR/Value.h
index 2ad1c9e8c3008..7527684d8d25a 100644
--- a/llvm/include/llvm/IR/Value.h
+++ b/llvm/include/llvm/IR/Value.h
@@ -781,8 +781,8 @@ class Value {
   ///
   /// This is the greatest alignment value supported by load, store, and alloca
   /// instructions, and global values.
-  static const unsigned MaxAlignmentExponent = 29;
-  static const unsigned MaximumAlignment = 1u << MaxAlignmentExponent;
+  static constexpr unsigned MaxAlignmentExponent = 29;
+  static constexpr unsigned MaximumAlignment = 1u << MaxAlignmentExponent;
 
   /// Mutate the type of this Value to be of the specified type.
   ///
        
    
    
More information about the llvm-commits
mailing list