From 20d0ab6157c1029c153bce80f39cf03837b7e717 Mon Sep 17 00:00:00 2001 From: Mehdi Amini Date: Sat, 20 Jun 2020 06:22:04 +0000 Subject: [PATCH] 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. --- mlir/include/mlir/IR/OpBase.td | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mlir/include/mlir/IR/OpBase.td b/mlir/include/mlir/IR/OpBase.td index b1a28572e003a..232a6ddcd9c6d 100644 --- a/mlir/include/mlir/IR/OpBase.td +++ b/mlir/include/mlir/IR/OpBase.td @@ -2073,7 +2073,7 @@ class ElementTypeIs : PredOpTrait< // Type Constraint operand `i`'s Element type is Same As operand `j`'s Element // type. class TCopVTEtIsSameAs : 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()",