AArch64: Assert on branch displacement bits
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Tue, 2 Aug 2016 08:56:52 +0000 (08:56 +0000)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Tue, 2 Aug 2016 08:56:52 +0000 (08:56 +0000)
llvm-svn: 277434

llvm/lib/Target/AArch64/AArch64InstrInfo.cpp

index 05bc1cb..d359953 100644 (file)
@@ -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;
 }