Make Value::MaxAlignment(Exponent) constexpr
authorAlex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Thu, 26 Aug 2021 08:51:23 +0000 (09:51 +0100)
committerAlex Richardson <Alexander.Richardson@cl.cam.ac.uk>
Thu, 26 Aug 2021 09:09:40 +0000 (10:09 +0100)
This avoids references to the variables be generated when using e.g. max().

Reviewed By: dexonsmith

Differential Revision: https://reviews.llvm.org/D95050

llvm/include/llvm/IR/Value.h

index 2ad1c9e..7527684 100644 (file)
@@ -781,8 +781,8 @@ public:
   ///
   /// 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.
   ///