[PATCH] D88195: Remove stale assert.

Bill Wendling via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 23 21:50:23 PDT 2020


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

Fix test case.


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.cpp


Index: clang/test/Modules/asm-goto.cpp
===================================================================
--- /dev/null
+++ clang/test/Modules/asm-goto.cpp
@@ -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 {{.*}} @_Z3foov(
+// CHECK: callbr {{.*}} "=r,X,{{.*}}"(i8* blockaddress(@_Z3foov, %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,9 @@
+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;
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88195.293938.patch
Type: text/x-patch
Size: 1676 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200924/ff7f1ff1/attachment.bin>


More information about the cfe-commits mailing list