[llvm] r294121 - [AVR] Fix a bug where asm operands are printed twice

Dylan McKay via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 5 02:42:49 PST 2017


Author: dylanmckay
Date: Sun Feb  5 04:42:49 2017
New Revision: 294121

URL: http://llvm.org/viewvc/llvm-project?rev=294121&view=rev
Log:
[AVR] Fix a bug where asm operands are printed twice

We would unconditionally call printOperand, even if PrintAsmOperand
already printed the immediate.

Added:
    llvm/trunk/test/CodeGen/AVR/no-print-operand-twice.ll
Modified:
    llvm/trunk/lib/Target/AVR/AVRAsmPrinter.cpp

Modified: llvm/trunk/lib/Target/AVR/AVRAsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AVR/AVRAsmPrinter.cpp?rev=294121&r1=294120&r2=294121&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AVR/AVRAsmPrinter.cpp (original)
+++ llvm/trunk/lib/Target/AVR/AVRAsmPrinter.cpp Sun Feb  5 04:42:49 2017
@@ -130,7 +130,8 @@ bool AVRAsmPrinter::PrintAsmOperand(cons
     }
   }
 
-  printOperand(MI, OpNum, O);
+  if (Error)
+    printOperand(MI, OpNum, O);
 
   return false;
 }

Added: llvm/trunk/test/CodeGen/AVR/no-print-operand-twice.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AVR/no-print-operand-twice.ll?rev=294121&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/AVR/no-print-operand-twice.ll (added)
+++ llvm/trunk/test/CodeGen/AVR/no-print-operand-twice.ll Sun Feb  5 04:42:49 2017
@@ -0,0 +1,8 @@
+; RUN: llc -no-integrated-as -march=avr < %s | FileCheck %s
+
+define void @test() {
+entry:
+; CHECK: /* result: 68719476738 */
+  tail call void asm sideeffect "/* result: ${0:c} */", "i,~{dirflag},~{fpsr},~{flags}"( i64 68719476738 )
+  ret void
+}




More information about the llvm-commits mailing list