[mlir][EmitC] Remove Pure trait from `emitc.include`
authorChristopher Bate <cbate@nvidia.com>
Thu, 8 Dec 2022 00:28:27 +0000 (17:28 -0700)
committerChristopher Bate <cbate@nvidia.com>
Tue, 17 Jan 2023 17:04:17 +0000 (10:04 -0700)
The op `emitc.include` does not have results and thus will be elided
during canonicalization, which is not correct behavior. This change
removes the 'Pure' trait and adds a canonicalization test.

Reviewed By: jpienaar, marbre

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

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

index 6986364..f6a8150 100644 (file)
@@ -148,7 +148,7 @@ def EmitC_ConstantOp : EmitC_Op<"constant", [ConstantLike]> {
 }
 
 def EmitC_IncludeOp
-    : EmitC_Op<"include", [Pure, HasParent<"ModuleOp">]> {
+    : EmitC_Op<"include", [HasParent<"ModuleOp">]> {
   let summary = "Include operation";
   let description = [{
     The `include` operation allows to define a source file inclusion via the
index 08b2845..b682aac 100644 (file)
@@ -1,5 +1,8 @@
 // RUN: mlir-opt %s | mlir-opt | FileCheck %s
+// RUN: mlir-opt %s -canonicalize | FileCheck %s
 
+// CHECK: emitc.include <"test.h">
+// CHECK: emitc.include "test.h"
 emitc.include <"test.h">
 emitc.include "test.h"