diff options
author | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-03-31 00:06:44 +0000 |
---|---|---|
committer | Jakob Stoklund Olesen <stoklund@2pi.dk> | 2012-03-31 00:06:44 +0000 |
commit | 3ee3661f8f10e7f82094a89c40d9118630ab0a40 (patch) | |
tree | 8b3ef8f008ea464be26d628d86b590403daedaf5 /lib/Target/ARM/ARMConstantIslandPass.cpp | |
parent | 101c03a8c9042781b6c9ba1fcc366e14fc8534ce (diff) |
Add a 2 byte safety margin in offset computations.
ARMConstantIslandPass still has bugs where jump table compression can
cause constant pool entries to go out of range.
Add a safety margin of 2 bytes when placing constant islands, but use
the real max displacement for verification.
<rdar://problem/11156595>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153789 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/ARMConstantIslandPass.cpp')
-rw-r--r-- | lib/Target/ARM/ARMConstantIslandPass.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Target/ARM/ARMConstantIslandPass.cpp b/lib/Target/ARM/ARMConstantIslandPass.cpp index f5221f05e4..fc35c7cb02 100644 --- a/lib/Target/ARM/ARMConstantIslandPass.cpp +++ b/lib/Target/ARM/ARMConstantIslandPass.cpp @@ -209,8 +209,9 @@ namespace { } /// getMaxDisp - Returns the maximum displacement supported by MI. /// Correct for unknown alignment. + /// Conservatively subtract 2 bytes to handle weird alignment effects. unsigned getMaxDisp() const { - return KnownAlignment ? MaxDisp : MaxDisp - 2; + return (KnownAlignment ? MaxDisp : MaxDisp - 2) - 2; } }; @@ -350,7 +351,9 @@ void ARMConstantIslands::verify() { for (unsigned i = 0, e = CPUsers.size(); i != e; ++i) { CPUser &U = CPUsers[i]; unsigned UserOffset = getUserOffset(U); - if (isCPEntryInRange(U.MI, UserOffset, U.CPEMI, U.getMaxDisp(), U.NegOk, + // Verify offset using the real max displacement without the safety + // adjustment. + if (isCPEntryInRange(U.MI, UserOffset, U.CPEMI, U.getMaxDisp()+2, U.NegOk, /* DoDump = */ true)) { DEBUG(dbgs() << "OK\n"); continue; |