================
@@ -0,0 +1,118 @@
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-cir %s -o
%t.cir
+// RUN: FileCheck --input-file=%t.cir %s --check-prefix=CIR
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fclangir -emit-llvm %s -o
%t-cir.ll
+// RUN: FileCheck --input-file=%t-cir.ll %s --check-prefix=LLVM
+// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-llvm %s -o %t.ll
+// RUN: FileCheck --input-file=%t.ll %s --check-prefix=OGCG
+
+// A `goto *p` inside a nested scope, jumping to a top-level label.
+int nested_goto(int x) {
+ void *p = &&done;
+ if (x)
+ goto *p;
+done:
+ return 0;
+}
+
+// CIR-LABEL: cir.func {{.*}} @nested_goto
+// CIR: %[[P:.*]] = cir.alloca "p"
+// CIR: cir.block_address <@nested_goto, "done"> : !cir.ptr<!void>
+// CIR: cir.scope {
+// CIR: cir.if %{{.*}} {
+// CIR: %[[T:.*]] = cir.load align(8) %[[P]]
+// CIR: cir.indirect_goto %[[T]] : !cir.ptr<!void>
+// CIR: }
+// CIR: }
+// CIR: cir.label "done"
+
+// LLVM-LABEL: define dso_local i32 @nested_goto
----------------
andykaylor wrote:
Can the LLVM and OGCG checks be combined?
https://github.com/llvm/llvm-project/pull/206176
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits