1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00

Duncan pointed out that if the alignment isn't explicitly specified, it defaults to the ABI alignment. Given that, make this code a bit more aggressive in such cases.

llvm-svn: 151584
This commit is contained in:
Eli Friedman 2012-02-27 23:16:46 +00:00
parent aa5e01bb84
commit 1ff1d1f1bc
2 changed files with 5 additions and 5 deletions

View File

@ -120,11 +120,11 @@ static uint64_t getObjectSize(const Value *V, const TargetData &TD,
return AliasAnalysis::UnknownSize; return AliasAnalysis::UnknownSize;
uint64_t Size = TD.getTypeAllocSize(AccessTy); uint64_t Size = TD.getTypeAllocSize(AccessTy);
if (RoundToAlign) { // If there is an explicitly specified alignment, and we need to
if (!Align) // take alignment into account, round up the size. (If the alignment
return AliasAnalysis::UnknownSize; // is implicit, getTypeAllocSize is sufficient.)
if (RoundToAlign && Align)
Size = RoundUpToAlignment(Size, Align); Size = RoundUpToAlignment(Size, Align);
}
return Size; return Size;
} }

View File

@ -4,7 +4,7 @@
; RUN: opt < %s -basicaa -gvn -S | FileCheck %s ; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128" target datalayout = "E-p:64:64:64-a0:0:8-f32:32:32-f64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-v64:64:64-v128:128:128"
@B = global i16 8, align 2 @B = global i16 8
; CHECK: @test1 ; CHECK: @test1
define i16 @test1(i32* %P) { define i16 @test1(i32* %P) {