diff options
| author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-04-30 20:19:00 +0000 |
|---|---|---|
| committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-04-30 20:19:00 +0000 |
| commit | 8503ba984f0d71317e8ea7b061f23aeb4f63ccf0 (patch) | |
| tree | cf8acf5231cb8d0b9bf158bb1c0a85dd5450e904 | |
| parent | e29a6c72ff39fccf81fc8927a3ded8ebe452aa39 (diff) | |
| download | bcm5719-llvm-8503ba984f0d71317e8ea7b061f23aeb4f63ccf0.tar.gz bcm5719-llvm-8503ba984f0d71317e8ea7b061f23aeb4f63ccf0.zip | |
Fix address calculation error from r155744.
This was exposed by SingleSource/UnitTests/Vector/constpool.c.
The computed size of a basic block isn't always a multiple of its known
alignment, and that can introduce extra alignment padding after the
block.
<rdar://problem/11347135>
llvm-svn: 155845
| -rw-r--r-- | llvm/lib/Target/ARM/ARMConstantIslandPass.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp index 3e4e732ddb9..10e9da42a94 100644 --- a/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp +++ b/llvm/lib/Target/ARM/ARMConstantIslandPass.cpp @@ -124,7 +124,12 @@ namespace { /// This number should be used to predict worst case padding when /// splitting the block. unsigned internalKnownBits() const { - return Unalign ? Unalign : KnownBits; + unsigned Bits = Unalign ? Unalign : KnownBits; + // If the block size isn't a multiple of the known bits, assume the + // worst case padding. + if (Size & ((1u << Bits) - 1)) + Bits = CountTrailingZeros_32(Size); + return Bits; } /// Compute the offset immediately following this block. If LogAlign is |

