Skip to content

Commit

Permalink
Fix warning caused by TableGen verifier predicate (NFC)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
joker-eph committed Jun 20, 2020
1 parent d313cb6 commit 20d0ab6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mlir/include/mlir/IR/OpBase.td
Expand Up @@ -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()",
Expand Down

0 comments on commit 20d0ab6

Please sign in to comment.