diff --git a/mlir/test/mlir-tblgen/llvm-intrinsics.td b/mlir/test/mlir-tblgen/llvm-intrinsics.td --- a/mlir/test/mlir-tblgen/llvm-intrinsics.td +++ b/mlir/test/mlir-tblgen/llvm-intrinsics.td @@ -20,8 +20,8 @@ // The second operand is overloadable, but the first operand needs to // match the result type. // CHECK: [1] -// It has no additional traits. -// CHECK: [] +// It has no side effects. +// CHECK: [NoSideEffect] // It has a result. // CHECK: 1> // CHECK: Arguments<(ins LLVM_Type, LLVM_Type diff --git a/mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp b/mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp --- a/mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp +++ b/mlir/tools/mlir-tblgen/LLVMIRIntrinsicGen.cpp @@ -140,23 +140,17 @@ /// Return true if the intrinsic may have side effects, i.e. does not have the /// `IntrNoMem` property. bool hasSideEffects() const { - auto props = record.getValueAsListOfDefs(fieldTraits); - for (const llvm::Record *r : props) { - if (r->getName() == "IntrNoMem") - return true; - } - return false; + return llvm::none_of( + record.getValueAsListOfDefs(fieldTraits), + [](const llvm::Record *r) { return r->getName() == "IntrNoMem"; }); } /// Return true if the intrinsic is commutative, i.e. has the respective /// property. bool isCommutative() const { - auto props = record.getValueAsListOfDefs(fieldTraits); - for (const llvm::Record *r : props) { - if (r->getName() == "Commutative") - return true; - } - return false; + return llvm::any_of( + record.getValueAsListOfDefs(fieldTraits), + [](const llvm::Record *r) { return r->getName() == "Commutative"; }); } IndicesTy getOverloadableOperandsIdxs() const {