From 553f794b6fce497d2950b7fcbfd32707dbedd745 Mon Sep 17 00:00:00 2001 From: Sean Silva Date: Wed, 18 Dec 2019 12:33:02 -0800 Subject: [PATCH] Add a couple useful LLVM_DEBUG's to the inliner. This makes it easier to narrow down on ops that are preventing inlining. PiperOrigin-RevId: 286243868 --- mlir/lib/Transforms/Inliner.cpp | 7 +++++++ mlir/lib/Transforms/Utils/InliningUtils.cpp | 8 +++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/mlir/lib/Transforms/Inliner.cpp b/mlir/lib/Transforms/Inliner.cpp index 9948a42..b158948 100644 --- a/mlir/lib/Transforms/Inliner.cpp +++ b/mlir/lib/Transforms/Inliner.cpp @@ -29,8 +29,11 @@ #include "mlir/Transforms/InliningUtils.h" #include "mlir/Transforms/Passes.h" #include "llvm/ADT/SCCIterator.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/Parallel.h" +#define DEBUG_TYPE "inlining" + using namespace mlir; static llvm::cl::opt disableCanonicalization( @@ -173,6 +176,10 @@ static LogicalResult inlineCallsInSCC(Inliner &inliner, bool inlinedAnyCalls = false; for (unsigned i = 0; i != calls.size(); ++i) { ResolvedCall &it = calls[i]; + LLVM_DEBUG({ + llvm::dbgs() << "* Considering inlining call: "; + it.call.dump(); + }); if (!shouldInline(it)) continue; diff --git a/mlir/lib/Transforms/Utils/InliningUtils.cpp b/mlir/lib/Transforms/Utils/InliningUtils.cpp index e8e6ae0..e8466aa 100644 --- a/mlir/lib/Transforms/Utils/InliningUtils.cpp +++ b/mlir/lib/Transforms/Utils/InliningUtils.cpp @@ -26,6 +26,7 @@ #include "mlir/IR/Function.h" #include "mlir/IR/Operation.h" #include "llvm/ADT/MapVector.h" +#include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" #define DEBUG_TYPE "inlining" @@ -110,8 +111,13 @@ static bool isLegalToInline(InlinerInterface &interface, Region *src, for (auto &block : *src) { for (auto &op : block) { // Check this operation. - if (!interface.isLegalToInline(&op, insertRegion, valueMapping)) + if (!interface.isLegalToInline(&op, insertRegion, valueMapping)) { + LLVM_DEBUG({ + llvm::dbgs() << "* Illegal to inline because of op: "; + op.dump(); + }); return false; + } // Check any nested regions. if (interface.shouldAnalyzeRecursively(&op) && llvm::any_of(op.getRegions(), [&](Region ®ion) { -- 2.7.4