[PATCH] D141589: [AVR] Fix a bug in AsmPrinter when printing inline-asm operands

Ben Shi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 12 22:24:03 PST 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG159e2a804d90: [AVR] Fix a bug in AsmPrinter when printing inline-asm operands (authored by benshi001).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D141589/new/

https://reviews.llvm.org/D141589

Files:
  llvm/lib/Target/AVR/AVRAsmPrinter.cpp
  llvm/test/CodeGen/AVR/inline-asm/inline-asm-invalid.ll


Index: llvm/test/CodeGen/AVR/inline-asm/inline-asm-invalid.ll
===================================================================
--- llvm/test/CodeGen/AVR/inline-asm/inline-asm-invalid.ll
+++ llvm/test/CodeGen/AVR/inline-asm/inline-asm-invalid.ll
@@ -8,3 +8,8 @@
   ret void
 }
 
+define void @foo1() {
+  ; CHECK: error: invalid operand in inline asm: ';; ${0:C}'
+  call i16 asm sideeffect ";; ${0:C}", "=d"()
+  ret void
+}
Index: llvm/lib/Target/AVR/AVRAsmPrinter.cpp
===================================================================
--- llvm/lib/Target/AVR/AVRAsmPrinter.cpp
+++ llvm/lib/Target/AVR/AVRAsmPrinter.cpp
@@ -128,8 +128,8 @@
       assert(BytesPerReg <= 2 && "Only 8 and 16 bit regs are supported.");
 
       unsigned RegIdx = ByteNumber / BytesPerReg;
-      assert(RegIdx < NumOpRegs && "Multibyte index out of range.");
-
+      if (RegIdx >= NumOpRegs)
+        return true;
       Reg = MI->getOperand(OpNum + RegIdx).getReg();
 
       if (BytesPerReg == 2) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D141589.488867.patch
Type: text/x-patch
Size: 987 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230113/fce77bd7/attachment.bin>


More information about the llvm-commits mailing list