From 1ce7d31f33320d5f9056b12b9c497cab1f643355 Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Wed, 17 Dec 2014 16:17:44 +0000 Subject: [PATCH] ARM: correct an off-by-one in an assert The assert was off-by-one, resulting in failures for valid input. Thanks to Asiri Rathnayake for pointing out the failure! llvm-svn: 224432 --- llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp | 5 ++++- llvm/test/MC/ARM/arm-store-deprecated.s | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp index 7610792..ecc7f0b 100644 --- a/llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp +++ b/llvm/lib/Target/ARM/MCTargetDesc/ARMMCTargetDesc.cpp @@ -77,7 +77,10 @@ static bool getITDeprecationInfo(MCInst &MI, MCSubtargetInfo &STI, static bool getARMStoreDeprecationInfo(MCInst &MI, MCSubtargetInfo &STI, std::string &Info) { - assert(MI.getNumOperands() > 4 && "expected >4 arguments"); + if (STI.getFeatureBits() & llvm::ARM::ModeThumb) + return false; + + assert(MI.getNumOperands() >= 4 && "expected >= 4 arguments"); for (unsigned OI = 4, OE = MI.getNumOperands(); OI < OE; ++OI) { assert(MI.getOperand(OI).isReg() && "expected register"); if (MI.getOperand(OI).getReg() == ARM::SP || diff --git a/llvm/test/MC/ARM/arm-store-deprecated.s b/llvm/test/MC/ARM/arm-store-deprecated.s index d8c10e2..8a598ab 100644 --- a/llvm/test/MC/ARM/arm-store-deprecated.s +++ b/llvm/test/MC/ARM/arm-store-deprecated.s @@ -145,3 +145,9 @@ push: @ CHECK: push {sp} @ CHECK: ^ + .global single + .type single,%function +single: + stmdaeq r0, {r0} +@ CHECK-NOT: warning + -- 2.7.4