Duncan pointed out that if the alignment isn't explicitly specified, it defaults...
[oota-llvm.git] / lib / Analysis / BasicAliasAnalysis.cpp
index 23b89ddf75f68011896180ca4eb8e3194e40a3b5..20ecfd26a986d529f3b4a6695dac7d0978bc1e59 100644 (file)
@@ -120,11 +120,11 @@ static uint64_t getObjectSize(const Value *V, const TargetData &TD,
     return AliasAnalysis::UnknownSize;
 
   uint64_t Size = TD.getTypeAllocSize(AccessTy);
-  if (RoundToAlign) {
-    if (!Align)
-      return AliasAnalysis::UnknownSize;
+  // If there is an explicitly specified alignment, and we need to
+  // take alignment into account, round up the size. (If the alignment
+  // is implicit, getTypeAllocSize is sufficient.)
+  if (RoundToAlign && Align)
     Size = RoundUpToAlignment(Size, Align);
-  }
 
   return Size;
 }