[clang] 34ca5b3 - Remove stale assert.

Bill Wendling via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 24 13:59:50 PDT 2020


Author: Bill Wendling
Date: 2020-09-24T13:59:42-07:00
New Revision: 34ca5b3392ced08e2320fb4236cca5c7df4ec6e9

URL: https://github.com/llvm/llvm-project/commit/34ca5b3392ced08e2320fb4236cca5c7df4ec6e9
DIFF: https://github.com/llvm/llvm-project/commit/34ca5b3392ced08e2320fb4236cca5c7df4ec6e9.diff

LOG: Remove stale assert.

This is triggered during serialization. The test is for modules, but
will occur for any serialization effort using asm goto.

Reviewed By: nickdesaulniers, jyknight

Differential Revision: https://reviews.llvm.org/D88195

Added: 
    clang/test/Modules/Inputs/asm-goto/a.h
    clang/test/Modules/Inputs/asm-goto/module.modulemap
    clang/test/Modules/asm-goto.c

Modified: 
    clang/lib/AST/Stmt.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp
index bdfaf410131c..e7024b2105fc 100644
--- a/clang/lib/AST/Stmt.cpp
+++ b/clang/lib/AST/Stmt.cpp
@@ -528,7 +528,6 @@ void GCCAsmStmt::setOutputsAndInputsAndClobbers(const ASTContext &C,
   this->NumInputs = NumInputs;
   this->NumClobbers = NumClobbers;
   this->NumLabels = NumLabels;
-  assert(!(NumOutputs && NumLabels) && "asm goto cannot have outputs");
 
   unsigned NumExprs = NumOutputs + NumInputs + NumLabels;
 

diff  --git a/clang/test/Modules/Inputs/asm-goto/a.h b/clang/test/Modules/Inputs/asm-goto/a.h
new file mode 100644
index 000000000000..877213c5d009
--- /dev/null
+++ b/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;
+}

diff  --git a/clang/test/Modules/Inputs/asm-goto/module.modulemap b/clang/test/Modules/Inputs/asm-goto/module.modulemap
new file mode 100644
index 000000000000..caf888fc474c
--- /dev/null
+++ b/clang/test/Modules/Inputs/asm-goto/module.modulemap
@@ -0,0 +1 @@
+module a { header "a.h" export * }

diff  --git a/clang/test/Modules/asm-goto.c b/clang/test/Modules/asm-goto.c
new file mode 100644
index 000000000000..fc6e45dd98fd
--- /dev/null
+++ b/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();
+}


        


More information about the cfe-commits mailing list