[PATCH] D20157: Add test for D20156

Diana Picus via llvm-commits llvm-commits at lists.llvm.org
Wed May 11 04:05:56 PDT 2016


rovka created this revision.
rovka added reviewers: rengolin, resistor, mcrosier, echristo, qcolombet, bogner.
rovka added subscribers: llvm-commits, cfe-commits.
Herald added a subscriber: joker.eph.

This adds a test for PR24071. Its purpose is to make sure that we do not assert after identifying an error in inline asm.

It has to be added in Clang because llc exits after identifying the error, and therefore never reaches the assert. The situation is similar to [1].

http://reviews.llvm.org/D20156

[1] https://www.mail-archive.com/cfe-commits@cs.uiuc.edu/msg70985.html

http://reviews.llvm.org/D20157

Files:
  test/CodeGen/arm64-asm-diag.c

Index: test/CodeGen/arm64-asm-diag.c
===================================================================
--- /dev/null
+++ test/CodeGen/arm64-asm-diag.c
@@ -0,0 +1,24 @@
+// RUN: not %clang_cc1 -triple arm64 %s -S -o /dev/null 2>&1 | FileCheck %s
+
+// This test makes sure that we correctly recover after an error is identified
+// in inline asm during instruction selection.
+// It needs to be in Clang because the diagnostic handler that is used by llc
+// in LLVM's CodeGen tests exits after identifying an error, whereas the
+// diagnostic handler used by Clang keeps running and may trigger assertions
+// (see PR24071).
+// This test as well as arm-asm-diag.c can be moved back into LLVM if llc is
+// updated to use a different diagnostic handler, that tries to catch as many
+// errors as possible without exiting.
+int foo(long int a, long int b){
+    const long int c = 32 - b;
+
+    long int r;
+    asm("lsl  %[o],%[s],%[a]"
+        :   [o]    "=r"  (r)
+        :   [s]    "r"   (a),
+            [a]    "n"   (c));
+
+    return r;
+}
+
+// CHECK: error: invalid operand for inline asm constraint 'n'


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20157.56873.patch
Type: text/x-patch
Size: 1119 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160511/a4db25c7/attachment.bin>


More information about the llvm-commits mailing list