#include "mlir/Transforms/Passes.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Operation.h"
#include "mlir/Pass/Pass.h"
namespace mlir {
#define GEN_PASS_DEF_STRIPDEBUGINFO
#include "mlir/Transforms/Passes.h.inc"
}
using namespace mlir;
namespace {
struct StripDebugInfo : public impl::StripDebugInfoBase<StripDebugInfo> {
void runOnOperation() override;
};
}
void StripDebugInfo::runOnOperation() {
auto unknownLoc = UnknownLoc::get(&getContext());
getOperation()->walk([&](Operation *op) {
op->setLoc(unknownLoc);
for (Region ®ion : op->getRegions()) {
for (Block &block : region.getBlocks()) {
for (BlockArgument &arg : block.getArguments()) {
arg.setLoc(unknownLoc);
}
}
}
});
}
std::unique_ptr<Pass> mlir::createStripDebugInfoPass() {
return std::make_unique<StripDebugInfo>();
}