[PATCH] D107259: [Arm] Add assert in T2 Imm7s code emitter

Simon Wallis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 2 02:39:28 PDT 2021


simonwallis2 created this revision.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls.
simonwallis2 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Add assert to provoke failure in object file output, not just in disassembly output.


https://reviews.llvm.org/D107259

Files:
  llvm/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp


Index: llvm/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp
===================================================================
--- llvm/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp
+++ llvm/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp
@@ -1138,6 +1138,7 @@
   // representation for the complex operand in the .td file. This isn't just
   // style, unfortunately. As-is, we can't represent the distinct encoding
   // for #-0.
+  assert(((Imm8 & 0x3) == 0) && "Not a valid immediate!");
   uint32_t Binary = (Imm8 >> 2) & 0xff;
   // Immediate is always encoded as positive. The 'U' bit controls add vs sub.
   if (isAdd)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107259.363415.patch
Type: text/x-patch
Size: 631 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210802/1c8b5167/attachment.bin>


More information about the llvm-commits mailing list