llvm-project/mlir/test/mlir-query/simple-test.mlir
Devajith 02d9f4d1f1 [mlir][mlir-query] Introduce mlir-query tool with autocomplete support
This commit adds the initial version of the mlir-query tool, which leverages the pre-existing matchers defined in mlir/include/mlir/IR/Matchers.h

The tool provides the following set of basic queries:

hasOpAttrName(string)
hasOpName(string)
isConstantOp()
isNegInfFloat()
isNegZeroFloat()
isNonZero()
isOne()
isOneFloat()
isPosInfFloat()
isPosZeroFloat()
isZero()
isZeroFloat()

Reviewed By: jpienaar

Differential Revision: https://reviews.llvm.org/D155127
2023-10-13 14:03:27 -07:00

17 lines
431 B
MLIR

// RUN: mlir-query %s -c "m isConstantOp()" | FileCheck %s
// CHECK: {{.*}}.mlir:5:13: note: "root" binds here
func.func @simple1() {
%c1_i32 = arith.constant 1 : i32
return
}
// CHECK: {{.*}}.mlir:12:11: note: "root" binds here
// CHECK: {{.*}}.mlir:13:11: note: "root" binds here
func.func @simple2() {
%cst1 = arith.constant 1.0 : f32
%cst2 = arith.constant 2.0 : f32
%add = arith.addf %cst1, %cst2 : f32
return
}