[Mlir-commits] [mlir] b254d55 - Apply clang-tidy fixes for readability-simplify-boolean-expr in SPIRVOps.cpp (NFC)

Mehdi Amini llvmlistbot at llvm.org
Tue Jun 28 12:53:13 PDT 2022


Author: Mehdi Amini
Date: 2022-06-28T19:51:28Z
New Revision: b254d55711437be4e2113eeb2261551b6b6defe6

URL: https://github.com/llvm/llvm-project/commit/b254d55711437be4e2113eeb2261551b6b6defe6
DIFF: https://github.com/llvm/llvm-project/commit/b254d55711437be4e2113eeb2261551b6b6defe6.diff

LOG: Apply clang-tidy fixes for readability-simplify-boolean-expr in SPIRVOps.cpp (NFC)

Added: 
    

Modified: 
    mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
index 4e7338fa1133c..1cb2d6801cb60 100644
--- a/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
+++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp
@@ -2546,7 +2546,7 @@ LogicalResult spirv::GroupBroadcastOp::verify() {
     return emitOpError("execution scope must be 'Workgroup' or 'Subgroup'");
 
   if (auto localIdTy = localid().getType().dyn_cast<VectorType>())
-    if (!(localIdTy.getNumElements() == 2 || localIdTy.getNumElements() == 3))
+    if (localIdTy.getNumElements() != 2 && localIdTy.getNumElements() != 3)
       return emitOpError("localid is a vector and can be with only "
                          " 2 or 3 components, actual number is ")
              << localIdTy.getNumElements();
@@ -4201,10 +4201,10 @@ LogicalResult spirv::GLSLFrexpStructOp::verify() {
   if (exponentVecTy) {
     IntegerType componentIntTy =
         exponentVecTy.getElementType().dyn_cast<IntegerType>();
-    if (!(componentIntTy && componentIntTy.getWidth() == 32))
+    if (!componentIntTy || componentIntTy.getWidth() != 32)
       return emitError("member one of the resulting struct type must"
                        "be a scalar or vector of 32 bit integer type");
-  } else if (!(exponentIntTy && exponentIntTy.getWidth() == 32)) {
+  } else if (!exponentIntTy || exponentIntTy.getWidth() != 32) {
     return emitError("member one of the resulting struct type "
                      "must be a scalar or vector of 32 bit integer type");
   }
@@ -4322,9 +4322,9 @@ LogicalResult spirv::ImageQuerySizeOp::verify() {
   case spirv::Dim::Dim2D:
   case spirv::Dim::Dim3D:
   case spirv::Dim::Cube:
-    if (!(samplingInfo == spirv::ImageSamplingInfo::MultiSampled ||
-          samplerInfo == spirv::ImageSamplerUseInfo::SamplerUnknown ||
-          samplerInfo == spirv::ImageSamplerUseInfo::NoSampler))
+    if (samplingInfo != spirv::ImageSamplingInfo::MultiSampled &&
+        samplerInfo != spirv::ImageSamplerUseInfo::SamplerUnknown &&
+        samplerInfo != spirv::ImageSamplerUseInfo::NoSampler)
       return emitError(
           "if Dim is 1D, 2D, 3D, or Cube, "
           "it must also have either an MS of 1 or a Sampled of 0 or 2");


        


More information about the Mlir-commits mailing list