================
@@ -0,0 +1,27 @@
+// RUN: cir-opt %s -cir-to-llvm -o - | FileCheck %s
+
+// Contract test for CIRToLLVMLLVMIntrinsicCallOpLowering: the op def
+// declares Optional<CIR_AnyType>:$result, so the lowering must accept
+// 0-result (void) calls in addition to the single-result case.
+
+!s32i = !cir.int<s, 32>
+
+module {
+ // 0-result, 0-operand.
+ // CHECK-LABEL: llvm.func @void_no_operands
+ // CHECK: llvm.call_intrinsic "llvm.donothing"() : () -> ()
+ // CHECK: llvm.return
+ cir.func @void_no_operands() {
+ cir.call_llvm_intrinsic "donothing" : () -> ()
----------------
skc7 wrote:
Hi @andykaylor
Agreed, ClangIR CIRGen never hits this path. But zero-result ops are valid IR
per the op definition (Optional<CIR_AnyType>:$result), and out-of-tree MLIR
producers lowering into `cir.call_llvm_intrinsic` can produce them and hit the
OOB. This patch fixes that scenario.
https://github.com/llvm/llvm-project/pull/199516
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits