[Mlir-commits] [mlir] e5eff53 - [mlir] Make StripDebugInfo strip out block arguments locs
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed May 26 11:05:59 PDT 2021
Author: thomasraoux
Date: 2021-05-26T11:05:38-07:00
New Revision: e5eff533f7611967ae1ead99846d06597dcb8ee2
URL: https://github.com/llvm/llvm-project/commit/e5eff533f7611967ae1ead99846d06597dcb8ee2
DIFF: https://github.com/llvm/llvm-project/commit/e5eff533f7611967ae1ead99846d06597dcb8ee2.diff
LOG: [mlir] Make StripDebugInfo strip out block arguments locs
Differential Revision: https://reviews.llvm.org/D103187
Added:
Modified:
mlir/lib/Transforms/StripDebugInfo.cpp
mlir/test/Transforms/strip-debuginfo.mlir
Removed:
################################################################################
diff --git a/mlir/lib/Transforms/StripDebugInfo.cpp b/mlir/lib/Transforms/StripDebugInfo.cpp
index 8b8206e0c4736..39db964969f9e 100644
--- a/mlir/lib/Transforms/StripDebugInfo.cpp
+++ b/mlir/lib/Transforms/StripDebugInfo.cpp
@@ -21,9 +21,20 @@ struct StripDebugInfo : public StripDebugInfoBase<StripDebugInfo> {
} // end anonymous namespace
void StripDebugInfo::runOnOperation() {
- // Strip the debug info from all operations.
auto unknownLoc = UnknownLoc::get(&getContext());
- getOperation()->walk([&](Operation *op) { op->setLoc(unknownLoc); });
+
+ // Strip the debug info from all operations.
+ getOperation()->walk([&](Operation *op) {
+ op->setLoc(unknownLoc);
+ // Strip block arguments debug info.
+ for (Region ®ion : op->getRegions()) {
+ for (Block &block : region.getBlocks()) {
+ for (BlockArgument &arg : block.getArguments()) {
+ arg.setLoc(unknownLoc);
+ }
+ }
+ }
+ });
}
/// Creates a pass to strip debug information from a function.
diff --git a/mlir/test/Transforms/strip-debuginfo.mlir b/mlir/test/Transforms/strip-debuginfo.mlir
index 8cd915e775a0c..3c785de72c469 100644
--- a/mlir/test/Transforms/strip-debuginfo.mlir
+++ b/mlir/test/Transforms/strip-debuginfo.mlir
@@ -17,6 +17,13 @@ func @inline_notation() -> i32 {
affine.if #set0(%2) {
} loc(fused<"myPass">["foo", "foo2"])
+ "foo.region"() ({
+ // CHECK: ^bb0(%{{.*}}: i32 loc(unknown), %{{.*}}: i32 loc(unknown)):
+ ^bb0(%a0: i32 loc("argloc"), %z: i32 loc("argloc2")):
+ %s = addi %a0, %a0 : i32
+ "foo.yield"(%s) : (i32) -> ()
+ }) : () -> ()
+
// CHECK: return %0 : i32 loc(unknown)
return %1 : i32 loc("bar")
}
More information about the Mlir-commits
mailing list