[PATCH] D23501: Correct the upper bound for a CBZ/CBNZ branch target.

Prakhar Bahuguna via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 15 07:26:59 PDT 2016


prakhar added inline comments.

================
Comment at: lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp:582
@@ -581,3 +581,3 @@
     // CB instructions can only branch to offsets in [0, 126] in multiples of 2
-    if (Ctx && ((int64_t)Value < 0 || Value > 0x3e || Value & 1)) {
+    if (Ctx && ((int64_t)Value < 0 || Value > 0x80 || Value & 1)) {
       Ctx->reportError(Fixup.getLoc(), "out of range pc-relative fixup value");
----------------
olista01 wrote:
> The 4-byte offset is being applied a few lines down, so should this actually be checking for the range [4, 130]?
The valid range is actually [2, 130] as offsets of 2 are relaxed to NOP. But yes I forgot to take the offset correction below into account.


https://reviews.llvm.org/D23501





More information about the llvm-commits mailing list