Skip checking preferred alignment of GVs defined in other translation units all together.
authorEvan Cheng <evan.cheng@apple.com>
Thu, 1 Apr 2010 20:13:28 +0000 (20:13 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 1 Apr 2010 20:13:28 +0000 (20:13 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100133 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAG.cpp

index 4fcfeecb49a5047983d9dc9e6624b901b1428e23..0ba65ab7f96d607b317e9ddcddf4129b25a5026f 100644 (file)
@@ -6152,7 +6152,7 @@ unsigned SelectionDAG::InferPtrAlignment(SDValue Ptr) const {
     unsigned Align = GV->getAlignment();
     if (!Align) {
       if (GlobalVariable *GVar = dyn_cast<GlobalVariable>(GV)) {
-        if (GV->getType()->getElementType()->isSized()) {
+        if (GVar->hasInitializer()) {
           const TargetData *TD = TLI.getTargetData();
           Align = TD->getPreferredAlignment(GVar);
         }