[Mlir-commits] [mlir] 20d0ab6 - Fix warning caused by TableGen verifier predicate (NFC)
Mehdi Amini
llvmlistbot at llvm.org
Fri Jun 19 23:31:25 PDT 2020
Author: Mehdi Amini
Date: 2020-06-20T06:31:06Z
New Revision: 20d0ab6157c1029c153bce80f39cf03837b7e717
URL: https://github.com/llvm/llvm-project/commit/20d0ab6157c1029c153bce80f39cf03837b7e717
DIFF: https://github.com/llvm/llvm-project/commit/20d0ab6157c1029c153bce80f39cf03837b7e717.diff
LOG: Fix warning caused by TableGen verifier predicate (NFC)
Avoid using max on unsigned constants, in case the caller is using 0 we
end up with:
warning: taking the max of unsigned zero and a value is always equal to the other value [-Wmax-unsigned-zero]
Instead we can just use native TableGen to fold the comparison here.
Added:
Modified:
mlir/include/mlir/IR/OpBase.td
Removed:
################################################################################
diff --git a/mlir/include/mlir/IR/OpBase.td b/mlir/include/mlir/IR/OpBase.td
index b1a28572e003..232a6ddcd9c6 100644
--- a/mlir/include/mlir/IR/OpBase.td
+++ b/mlir/include/mlir/IR/OpBase.td
@@ -2073,7 +2073,7 @@ class ElementTypeIs<string name, Type type> : PredOpTrait<
// Type Constraint operand `i`'s Element type is Same As operand `j`'s Element
// type.
class TCopVTEtIsSameAs<int i, int j> : And<[
- CPred<"$_op.getNumOperands() > std::max(" # i # "u," # j # "u)">,
+ CPred<"$_op.getNumOperands() > " # !if(!gt(i,j),i,j)>,
SubstLeaves<"$_self", "$_op.getOperand(" # i # ").getType()",
IsShapedTypePred>,
SubstLeaves<"$_self", "$_op.getOperand(" # j # ").getType()",
More information about the Mlir-commits
mailing list