[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 03:16:38 PST 2023
benshi001 created this revision.
benshi001 added reviewers: aykevl, Miss_Grape.
Herald added subscribers: Jim, hiraditya, dylanmckay.
Herald added a project: All.
benshi001 requested review of this revision.
Herald added subscribers: llvm-commits, jacquesguan.
Herald added a project: LLVM.
Repository:
rG LLVM Github Monorepo
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.488583.patch
Type: text/x-patch
Size: 987 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230112/ac410478/attachment.bin>
More information about the llvm-commits
mailing list