void updated this revision to Diff 294141.
void added a comment.

Fix test.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D88195

Files:
  clang/lib/AST/Stmt.cpp
  clang/test/Modules/Inputs/asm-goto/a.h
  clang/test/Modules/Inputs/asm-goto/module.modulemap
  clang/test/Modules/asm-goto.c


Index: clang/test/Modules/asm-goto.c
===================================================================
--- /dev/null
+++ clang/test/Modules/asm-goto.c
@@ -0,0 +1,12 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fno-implicit-modules -x c -I%S/Inputs/asm-goto 
-emit-module %S/Inputs/asm-goto/module.modulemap -fmodule-name=a -o %t/a.pcm
+// RUN: %clang_cc1 -fmodules -fno-implicit-modules -x c -I%S/Inputs/asm-goto 
-emit-llvm -o - %s -fmodule-file=%t/a.pcm | FileCheck %s
+#include "a.h"
+
+// CHECK-LABEL: define i32 @foo(
+// CHECK: callbr {{.*}} "=r,X,{{.*}}"(i8* blockaddress(@foo, %indirect))
+// CHECK-NEXT: to label %asm.fallthrough [label %indirect]
+
+int bar(void) {
+  return foo();
+}
Index: clang/test/Modules/Inputs/asm-goto/module.modulemap
===================================================================
--- /dev/null
+++ clang/test/Modules/Inputs/asm-goto/module.modulemap
@@ -0,0 +1 @@
+module a { header "a.h" export * }
Index: clang/test/Modules/Inputs/asm-goto/a.h
===================================================================
--- /dev/null
+++ clang/test/Modules/Inputs/asm-goto/a.h
@@ -0,0 +1,13 @@
+int foo(void) {
+  int x;
+
+  asm goto(""
+           : "=r"(x)
+           :
+           :
+           : indirect);
+  x = 42;
+
+indirect:
+  return x;
+}
Index: clang/lib/AST/Stmt.cpp
===================================================================
--- clang/lib/AST/Stmt.cpp
+++ clang/lib/AST/Stmt.cpp
@@ -528,7 +528,6 @@
   this->NumInputs = NumInputs;
   this->NumClobbers = NumClobbers;
   this->NumLabels = NumLabels;
-  assert(!(NumOutputs && NumLabels) && "asm goto cannot have outputs");
 
   unsigned NumExprs = NumOutputs + NumInputs + NumLabels;
 


Index: clang/test/Modules/asm-goto.c
===================================================================
--- /dev/null
+++ clang/test/Modules/asm-goto.c
@@ -0,0 +1,12 @@
+// RUN: rm -rf %t
+// RUN: %clang_cc1 -fmodules -fno-implicit-modules -x c -I%S/Inputs/asm-goto -emit-module %S/Inputs/asm-goto/module.modulemap -fmodule-name=a -o %t/a.pcm
+// RUN: %clang_cc1 -fmodules -fno-implicit-modules -x c -I%S/Inputs/asm-goto -emit-llvm -o - %s -fmodule-file=%t/a.pcm | FileCheck %s
+#include "a.h"
+
+// CHECK-LABEL: define i32 @foo(
+// CHECK: callbr {{.*}} "=r,X,{{.*}}"(i8* blockaddress(@foo, %indirect))
+// CHECK-NEXT: to label %asm.fallthrough [label %indirect]
+
+int bar(void) {
+  return foo();
+}
Index: clang/test/Modules/Inputs/asm-goto/module.modulemap
===================================================================
--- /dev/null
+++ clang/test/Modules/Inputs/asm-goto/module.modulemap
@@ -0,0 +1 @@
+module a { header "a.h" export * }
Index: clang/test/Modules/Inputs/asm-goto/a.h
===================================================================
--- /dev/null
+++ clang/test/Modules/Inputs/asm-goto/a.h
@@ -0,0 +1,13 @@
+int foo(void) {
+  int x;
+
+  asm goto(""
+           : "=r"(x)
+           :
+           :
+           : indirect);
+  x = 42;
+
+indirect:
+  return x;
+}
Index: clang/lib/AST/Stmt.cpp
===================================================================
--- clang/lib/AST/Stmt.cpp
+++ clang/lib/AST/Stmt.cpp
@@ -528,7 +528,6 @@
   this->NumInputs = NumInputs;
   this->NumClobbers = NumClobbers;
   this->NumLabels = NumLabels;
-  assert(!(NumOutputs && NumLabels) && "asm goto cannot have outputs");
 
   unsigned NumExprs = NumOutputs + NumInputs + NumLabels;
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to