[llvm-commits] [llvm] r109891 - in /llvm/trunk: include/llvm/Value.h lib/AsmParser/LLParser.cpp lib/Transforms/InstCombine/InstCombineCalls.cpp

Dan Gohman gohman at apple.com
Fri Jul 30 14:07:05 PDT 2010


Author: djg
Date: Fri Jul 30 16:07:05 2010
New Revision: 109891

URL: http://llvm.org/viewvc/llvm-project?rev=109891&view=rev
Log:
Move MaximumAlignment to be a member of the Value class.

Modified:
    llvm/trunk/include/llvm/Value.h
    llvm/trunk/lib/AsmParser/LLParser.cpp
    llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp

Modified: llvm/trunk/include/llvm/Value.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Value.h?rev=109891&r1=109890&r2=109891&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Value.h (original)
+++ llvm/trunk/include/llvm/Value.h Fri Jul 30 16:07:05 2010
@@ -307,6 +307,10 @@
     return const_cast<Value*>(this)->DoPHITranslation(CurBB, PredBB);
   }
   
+  /// MaximumAlignment - This is the greatest alignment value supported by
+  /// load, store, and alloca instructions, and global values.
+  static const unsigned MaximumAlignment = 1u << 29;
+  
 protected:
   unsigned short getSubclassDataFromValue() const { return SubclassData; }
   void setValueSubclassData(unsigned short D) { SubclassData = D; }
@@ -401,10 +405,6 @@
   enum { NumLowBitsAvailable = 2 };
 };
 
-/// MaximumAlignment - This is the greatest alignment value supported by
-/// load, store, and alloca instructions, and global values.
-static const unsigned MaximumAlignment = 1u << 29;
-
 } // End llvm namespace
 
 #endif

Modified: llvm/trunk/lib/AsmParser/LLParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/AsmParser/LLParser.cpp?rev=109891&r1=109890&r2=109891&view=diff
==============================================================================
--- llvm/trunk/lib/AsmParser/LLParser.cpp (original)
+++ llvm/trunk/lib/AsmParser/LLParser.cpp Fri Jul 30 16:07:05 2010
@@ -1154,7 +1154,7 @@
   if (ParseUInt32(Alignment)) return true;
   if (!isPowerOf2_32(Alignment))
     return Error(AlignLoc, "alignment is not a power of two");
-  if (Alignment > MaximumAlignment)
+  if (Alignment > Value::MaximumAlignment)
     return Error(AlignLoc, "huge alignments are not supported yet");
   return false;
 }

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp?rev=109891&r1=109890&r2=109891&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCalls.cpp Fri Jul 30 16:07:05 2010
@@ -109,9 +109,10 @@
   TrailZ = std::min(TrailZ, unsigned(sizeof(unsigned) * CHAR_BIT - 1));
 
   unsigned Align = 1u << std::min(BitWidth - 1, TrailZ);
+  unsigned MaxAlign = Value::MaximumAlignment;
 
   // LLVM doesn't support alignments larger than this currently.
-  Align = std::min(Align, MaximumAlignment);
+  Align = std::min(Align, MaxAlign);
 
   if (PrefAlign > Align)
     Align = EnforceKnownAlignment(V, Align, PrefAlign);





More information about the llvm-commits mailing list