From b948c524166510217c1fd68e9fa567cc04a3fa9b Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Mon, 15 Aug 2016 18:50:13 +0000 Subject: [PATCH] Revert "[Thumb] Validate branch target for CBZ/CBNZ instructions." This currently breaks the greendragon clang-stage1-configure-RA/ and brotli. It is probably just uncovering a pre-existing problem. Reverting temporarily to get the buildbots green again. A reduced testcase will follow shortly. This reverts commit r278659. llvm-svn: 278711 --- llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 6 ------ llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp | 5 ----- llvm/test/MC/ARM/thumb-cb-negative-offsets.s | 19 ------------------- llvm/test/MC/ARM/thumb-diagnostics.s | 17 ----------------- 4 files changed, 47 deletions(-) delete mode 100644 llvm/test/MC/ARM/thumb-cb-negative-offsets.s diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index c011c79..b9b665f 100644 --- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -6684,12 +6684,6 @@ bool ARMAsmParser::validateInstruction(MCInst &Inst, return Error(Operands[Op]->getStartLoc(), "branch target out of range"); break; } - case ARM::tCBZ: - case ARM::tCBNZ: { - if (!static_cast(*Operands[2]).isUnsignedOffset<6, 1>()) - return Error(Operands[2]->getStartLoc(), "branch target out of range"); - break; - } case ARM::MOVi16: case ARM::t2MOVi16: case ARM::t2MOVTi16: diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp index 5ac2d65..26f96ab 100644 --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp @@ -578,11 +578,6 @@ unsigned ARMAsmBackend::adjustFixupValue(const MCFixup &Fixup, uint64_t Value, // Offset by 4, and don't encode the low two bits. return ((Value - 4) >> 2) & 0xff; case ARM::fixup_arm_thumb_cb: { - // CB instructions can only branch to offsets in [0, 126] in multiples of 2 - if (Ctx && ((int64_t)Value < 0 || Value > 0x3e || Value & 1)) { - Ctx->reportError(Fixup.getLoc(), "out of range pc-relative fixup value"); - return 0; - } // Offset by 4 and don't encode the lower bit, which is always 0. // FIXME: diagnose if no Thumb2 uint32_t Binary = (Value - 4) >> 1; diff --git a/llvm/test/MC/ARM/thumb-cb-negative-offsets.s b/llvm/test/MC/ARM/thumb-cb-negative-offsets.s deleted file mode 100644 index cd70126..0000000 --- a/llvm/test/MC/ARM/thumb-cb-negative-offsets.s +++ /dev/null @@ -1,19 +0,0 @@ -@ RUN: not llvm-mc -triple thumbv7m-none-eabi -filetype=obj -o /dev/null %s 2>&1 | FileCheck %s -@ RUN: not llvm-mc -triple thumbv8m.base-none-eabi -filetype=obj -o /dev/null %s 2>&1 | FileCheck %s - -label0: - .word 4 - -@ CHECK: out of range pc-relative fixup value - cbz r0, label0 -@ CHECK: out of range pc-relative fixup value - cbnz r0, label0 - -@ CHECK: out of range pc-relative fixup value - cbz r0, label1 -@ CHECK: out of range pc-relative fixup value - cbnz r0, label1 - - .space 1000 -label1: - .word 4 diff --git a/llvm/test/MC/ARM/thumb-diagnostics.s b/llvm/test/MC/ARM/thumb-diagnostics.s index 65d8ed6..5dcac90 100644 --- a/llvm/test/MC/ARM/thumb-diagnostics.s +++ b/llvm/test/MC/ARM/thumb-diagnostics.s @@ -235,23 +235,6 @@ error: invalid operand for instruction @ CHECK-ERRORS: error: branch target out of range @------------------------------------------------------------------------------ -@ CBZ/CBNZ - out of range immediates for branches -@------------------------------------------------------------------------------ - - cbz r0, #-2 - cbz r0, #0 - cbz r0, #17 - cbnz r0, #126 - cbnz r0, #128 - -@ CHECK-ERRORS-V7M: error: branch target out of range -@ CHECK-ERRORS-V7M: error: invalid operand for instruction -@ CHECK-ERRORS-V7M: error: branch target out of range -@ CHECK-ERRORS-V8: error: branch target out of range -@ CHECK-ERRORS-V8: error: invalid operand for instruction -@ CHECK-ERRORS-V8: error: branch target out of range - -@------------------------------------------------------------------------------ @ SEV/WFE/WFI/YIELD - are not supported pre v6M or v6T2 @------------------------------------------------------------------------------ sev -- 2.7.4