Minor cleanup: use getDeclAlignInBytes helper.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65611 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 75a8302..6ebe127 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -713,17 +713,7 @@
 
   GV->setInitializer(Init);
   GV->setConstant(D->getType().isConstant(Context));
-
-  // FIXME: This is silly; getTypeAlign should just work for incomplete arrays
-  unsigned Align;
-  if (const IncompleteArrayType* IAT =
-        Context.getAsIncompleteArrayType(D->getType()))
-    Align = Context.getTypeAlign(IAT->getElementType());
-  else
-    Align = Context.getTypeAlign(D->getType());
-  if (const AlignedAttr* AA = D->getAttr<AlignedAttr>())
-    Align = std::max(Align, AA->getAlignment());
-  GV->setAlignment(Align / 8);
+  GV->setAlignment(getContext().getDeclAlignInBytes(D));
 
   if (const VisibilityAttr *attr = D->getAttr<VisibilityAttr>())
     setGlobalVisibility(GV, attr->getVisibility());