[flang-commits] [flang] [Flang] Clean up LoopVersioning LLVM_DEBUG blocks. NFC (PR #77818)
David Green via flang-commits
flang-commits at lists.llvm.org
Thu Jan 11 11:03:40 PST 2024
https://github.com/davemgreen created https://github.com/llvm/llvm-project/pull/77818
Just a little trick to put LLVM_DEBUG blocks into separate { } scopes, so they clang-format better.
>From 4f67b32d19d3de60b06aa88271558d3fc563a163 Mon Sep 17 00:00:00 2001
From: David Green <david.green at arm.com>
Date: Thu, 11 Jan 2024 18:41:21 +0000
Subject: [PATCH] [Flang] Clean up LoopVersioning LLVM_DEBUG blocks. NFC
Just a little trick to put LLVM_DEBUG blocks into separate { } scopes, so they
clang-format better.
---
.../Optimizer/Transforms/LoopVersioning.cpp | 70 +++++++++----------
1 file changed, 32 insertions(+), 38 deletions(-)
diff --git a/flang/lib/Optimizer/Transforms/LoopVersioning.cpp b/flang/lib/Optimizer/Transforms/LoopVersioning.cpp
index 5d6a23b86d06ef..48e42bdab5c0eb 100644
--- a/flang/lib/Optimizer/Transforms/LoopVersioning.cpp
+++ b/flang/lib/Optimizer/Transforms/LoopVersioning.cpp
@@ -105,26 +105,24 @@ struct ArgsUsageInLoop {
// Debug dump of the structure members assuming that
// the information has been collected for the given loop.
void dump(fir::DoLoopOp loop) const {
- // clang-format off
- LLVM_DEBUG(
- mlir::OpPrintingFlags printFlags;
- printFlags.skipRegions();
- llvm::dbgs() << "Arguments usage info for loop:\n";
- loop.print(llvm::dbgs(), printFlags);
- llvm::dbgs() << "\nUsed args:\n";
- for (auto &use : usageInfo) {
- mlir::Value v = use.first;
- v.print(llvm::dbgs(), printFlags);
- llvm::dbgs() << "\n";
- }
- llvm::dbgs() << "\nCannot transform args:\n";
- for (mlir::Value arg : cannotTransform) {
- arg.print(llvm::dbgs(), printFlags);
- llvm::dbgs() << "\n";
- }
- llvm::dbgs() << "====\n"
- );
- // clang-format on
+ LLVM_DEBUG({
+ mlir::OpPrintingFlags printFlags;
+ printFlags.skipRegions();
+ llvm::dbgs() << "Arguments usage info for loop:\n";
+ loop.print(llvm::dbgs(), printFlags);
+ llvm::dbgs() << "\nUsed args:\n";
+ for (auto &use : usageInfo) {
+ mlir::Value v = use.first;
+ v.print(llvm::dbgs(), printFlags);
+ llvm::dbgs() << "\n";
+ }
+ llvm::dbgs() << "\nCannot transform args:\n";
+ for (mlir::Value arg : cannotTransform) {
+ arg.print(llvm::dbgs(), printFlags);
+ llvm::dbgs() << "\n";
+ }
+ llvm::dbgs() << "====\n";
+ });
}
// Erase usageInfo and cannotTransform entries for a set
@@ -344,15 +342,13 @@ void LoopVersioningPass::runOnOperation() {
});
// Dump loops info after initial collection.
- // clang-format off
- LLVM_DEBUG(
- llvm::dbgs() << "Initial usage info:\n";
- for (fir::DoLoopOp loop : originalLoops) {
- auto &argsInLoop = argsInLoops[loop];
- argsInLoop.dump(loop);
- }
- );
- // clang-format on
+ LLVM_DEBUG({
+ llvm::dbgs() << "Initial usage info:\n";
+ for (fir::DoLoopOp loop : originalLoops) {
+ auto &argsInLoop = argsInLoops[loop];
+ argsInLoop.dump(loop);
+ }
+ });
// Clear argument usage for parent loops if an inner loop
// contains a non-transformable usage.
@@ -382,15 +378,13 @@ void LoopVersioningPass::runOnOperation() {
});
}
- // clang-format off
- LLVM_DEBUG(
- llvm::dbgs() << "Final usage info:\n";
- for (fir::DoLoopOp loop : originalLoops) {
- auto &argsInLoop = argsInLoops[loop];
- argsInLoop.dump(loop);
- }
- );
- // clang-format on
+ LLVM_DEBUG({
+ llvm::dbgs() << "Final usage info:\n";
+ for (fir::DoLoopOp loop : originalLoops) {
+ auto &argsInLoop = argsInLoops[loop];
+ argsInLoop.dump(loop);
+ }
+ });
// Reduce the collected information to a list of loops
// with attached arguments usage information.
More information about the flang-commits
mailing list