Skip to content

Commit 7725b6f

Browse files
authored
[NFC][mlir][SPIR-V] Rename getUnaryOpResultType to getMatchingBoolType (llvm#191773)
The old name was misleading because this function is not specific to unary ops suggested in llvm#189099 (comment)
1 parent fbd0bcf commit 7725b6f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

mlir/include/mlir/Dialect/SPIRV/IR/SPIRVLogicalOps.td

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class SPIRV_LogicalBinaryOp<string mnemonic, Type operandsType,
2727
TypesMatchWith<"type of result to correspond to the `i1` "
2828
"equivalent of the operand",
2929
"operand1", "result",
30-
"getUnaryOpResultType($_self)"
30+
"getMatchingBoolType($_self)"
3131
>])> {
3232
let assemblyFormat = "$operand1 `,` $operand2 `:` type($operand1) attr-dict";
3333
}
@@ -41,7 +41,7 @@ class SPIRV_LogicalUnaryOp<string mnemonic, Type operandType,
4141
TypesMatchWith<"type of result to correspond to the `i1` "
4242
"equivalent of the operand",
4343
"operand", "result",
44-
"getUnaryOpResultType($_self)"
44+
"getMatchingBoolType($_self)"
4545
>])> {
4646
let assemblyFormat = "$operand `:` type($operand) attr-dict";
4747
}

mlir/lib/Dialect/SPIRV/IR/SPIRVOpDefinition.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ static bool isDirectInModuleLikeOp(Operation *op) {
4949
return op && op->hasTrait<OpTrait::SymbolTable>();
5050
}
5151

52-
/// Result of a logical op must be a scalar or vector of boolean type.
53-
static Type getUnaryOpResultType(Type operandType) {
52+
/// Returns a boolean scalar or vector type matching the shape of the given
53+
/// type. Scalar inputs yield i1, vector inputs yield vector<Nxi1>.
54+
static Type getMatchingBoolType(Type operandType) {
5455
Builder builder(operandType.getContext());
5556
Type resultType = builder.getIntegerType(1);
5657
if (auto vecType = dyn_cast<VectorType>(operandType))

0 commit comments

Comments
 (0)