[llvm] r300634 - [DataLayout] Removed default value from a variable that isn't used without being overwritten. Make variable an enum instead of an int to avoid a cast later. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 18 17:31:38 PDT 2017


Author: ctopper
Date: Tue Apr 18 19:31:38 2017
New Revision: 300634

URL: http://llvm.org/viewvc/llvm-project?rev=300634&view=rev
Log:
[DataLayout] Removed default value from a variable that isn't used without being overwritten. Make variable an enum instead of an int to avoid a cast later. NFC

Modified:
    llvm/trunk/lib/IR/DataLayout.cpp

Modified: llvm/trunk/lib/IR/DataLayout.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DataLayout.cpp?rev=300634&r1=300633&r2=300634&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DataLayout.cpp (original)
+++ llvm/trunk/lib/IR/DataLayout.cpp Tue Apr 18 19:31:38 2017
@@ -621,7 +621,7 @@ unsigned DataLayout::getPointerTypeSizeI
   == false) for the requested type \a Ty.
  */
 unsigned DataLayout::getAlignment(Type *Ty, bool abi_or_pref) const {
-  int AlignType = -1;
+  AlignTypeEnum AlignType;
 
   assert(Ty->isSized() && "Cannot getTypeInfo() on a type that is unsized!");
   switch (Ty->getTypeID()) {
@@ -670,8 +670,7 @@ unsigned DataLayout::getAlignment(Type *
     llvm_unreachable("Bad type for getAlignment!!!");
   }
 
-  return getAlignmentInfo((AlignTypeEnum)AlignType, getTypeSizeInBits(Ty),
-                          abi_or_pref, Ty);
+  return getAlignmentInfo(AlignType, getTypeSizeInBits(Ty), abi_or_pref, Ty);
 }
 
 unsigned DataLayout::getABITypeAlignment(Type *Ty) const {




More information about the llvm-commits mailing list