Skip to content

Commit 8b2ad5c

Browse files
authored
[mlir][EmitC] Remove restrictions on include op (#106953)
An `emitc.include` should be usable even though the parent is not a ModuleOp. This requirement is therefore removed.
1 parent 60ed104 commit 8b2ad5c

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

mlir/include/mlir/Dialect/EmitC/IR/EmitC.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ def EmitC_ReturnOp : EmitC_Op<"return", [Pure, HasParent<"FuncOp">,
730730
}
731731

732732
def EmitC_IncludeOp
733-
: EmitC_Op<"include", [HasParent<"ModuleOp">]> {
733+
: EmitC_Op<"include", []> {
734734
let summary = "Include operation";
735735
let description = [{
736736
The `emitc.include` operation allows to define a source file inclusion via the

mlir/test/Target/Cpp/common-cpp.mlir

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ emitc.include "myheader.h"
55
// CHECK: #include <myheader.h>
66
emitc.include <"myheader.h">
77

8+
// CHECK: void test_include() {
9+
func.func @test_include() {
10+
// CHECK: #include "myheader.h"
11+
emitc.include "myheader.h"
12+
return
13+
}
14+
815
// CHECK: void test_foo_print() {
916
func.func @test_foo_print() {
1017
// CHECK: [[V1:[^ ]*]] = foo::constant({0, 1});

0 commit comments

Comments
 (0)