[Mlir-commits] [mlir] fd91f81 - [mlir][spirv] Put debug-only variable in LLVM_DEBUG
Lei Zhang
llvmlistbot at llvm.org
Mon Apr 12 12:14:50 PDT 2021
Author: Lei Zhang
Date: 2021-04-12T15:14:43-04:00
New Revision: fd91f81c857a6d51957944f159c18c070eef81ed
URL: https://github.com/llvm/llvm-project/commit/fd91f81c857a6d51957944f159c18c070eef81ed
DIFF: https://github.com/llvm/llvm-project/commit/fd91f81c857a6d51957944f159c18c070eef81ed.diff
LOG: [mlir][spirv] Put debug-only variable in LLVM_DEBUG
This avoids paying the cost when building in release.
Reviewed By: hanchung
Differential Revision: https://reviews.llvm.org/D100325
Added:
Modified:
mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp
Removed:
################################################################################
diff --git a/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp b/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp
index d26299fa82a9c..9063b5f6cd678 100644
--- a/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp
+++ b/mlir/lib/Dialect/SPIRV/Transforms/SPIRVConversion.cpp
@@ -42,14 +42,15 @@ static LogicalResult checkExtensionRequirements(
if (targetEnv.allows(ors))
continue;
- SmallVector<StringRef, 4> extStrings;
- for (spirv::Extension ext : ors)
- extStrings.push_back(spirv::stringifyExtension(ext));
-
- LLVM_DEBUG(llvm::dbgs()
- << label << " illegal: requires at least one extension in ["
- << llvm::join(extStrings, ", ")
- << "] but none allowed in target environment\n");
+ LLVM_DEBUG({
+ SmallVector<StringRef> extStrings;
+ for (spirv::Extension ext : ors)
+ extStrings.push_back(spirv::stringifyExtension(ext));
+
+ llvm::dbgs() << label << " illegal: requires at least one extension in ["
+ << llvm::join(extStrings, ", ")
+ << "] but none allowed in target environment\n";
+ });
return failure();
}
return success();
@@ -69,14 +70,15 @@ static LogicalResult checkCapabilityRequirements(
if (targetEnv.allows(ors))
continue;
- SmallVector<StringRef, 4> capStrings;
- for (spirv::Capability cap : ors)
- capStrings.push_back(spirv::stringifyCapability(cap));
+ LLVM_DEBUG({
+ SmallVector<StringRef> capStrings;
+ for (spirv::Capability cap : ors)
+ capStrings.push_back(spirv::stringifyCapability(cap));
- LLVM_DEBUG(llvm::dbgs()
- << label << " illegal: requires at least one capability in ["
- << llvm::join(capStrings, ", ")
- << "] but none allowed in target environment\n");
+ llvm::dbgs() << label << " illegal: requires at least one capability in ["
+ << llvm::join(capStrings, ", ")
+ << "] but none allowed in target environment\n";
+ });
return failure();
}
return success();
More information about the Mlir-commits
mailing list