From: Matt Arsenault Date: Tue, 2 Aug 2016 08:56:52 +0000 (+0000) Subject: AArch64: Assert on branch displacement bits X-Git-Tag: llvmorg-4.0.0-rc1~13590 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f1ae3c7db43a312d638cbcde2b431026d211d8d;p=platform%2Fupstream%2Fllvm.git AArch64: Assert on branch displacement bits llvm-svn: 277434 --- diff --git a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp index 05bc1cb..d359953 100644 --- a/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp +++ b/llvm/lib/Target/AArch64/AArch64InstrInfo.cpp @@ -132,6 +132,13 @@ static unsigned getBranchMaxDisplacementBytes(unsigned Opc) { unsigned Bits = getBranchDisplacementBits(Opc); unsigned MaxOffs = ((1 << (Bits - 1)) - 1) << 2; + + // Verify the displacement bits options have sane values. + // XXX: Is there a better place for this? + assert(MaxOffs >= 8 && + "max branch displacement must be enough to jump" + "over conditional branch expansion"); + return MaxOffs; }