[PATCH] D95050: Make Value::MaxAlignment(Exponent) constexpr

Alexander Richardson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 20 07:48:48 PST 2021


arichardson created this revision.
arichardson added a reviewer: jfb.
Herald added a subscriber: dexonsmith.
arichardson requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

This avoids references to the variables be generated when using e.g. max().


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D95050

Files:
  llvm/include/llvm/IR/Value.h


Index: llvm/include/llvm/IR/Value.h
===================================================================
--- llvm/include/llvm/IR/Value.h
+++ llvm/include/llvm/IR/Value.h
@@ -769,8 +769,8 @@
   ///
   /// 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.
   ///


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D95050.317876.patch
Type: text/x-patch
Size: 649 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210120/667e1924/attachment.bin>


More information about the llvm-commits mailing list