[PATCH] D75476: [mlir] Add support for detecting single use callables in the Inliner.
Mehdi AMINI via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 14 12:20:10 PDT 2020
mehdi_amini accepted this revision.
mehdi_amini added inline comments.
This revision is now accepted and ready to land.
================
Comment at: mlir/lib/Transforms/Inliner.cpp:192
+ };
+ walkSymbolTables(op, /*opIsHidden=*/!op->getBlock(), walkFn);
+
----------------
I don't quite get the `!op->getBlock()`?'
(top-level module isn't hidden but isn't in a block)
================
Comment at: mlir/lib/Transforms/Inliner.cpp:245
+ if (!SymbolTable::isSymbol(node->getCallableRegion()->getParentOp())) {
+ Operation *nodeOp = node->getCallableRegion()->getParentOp();
+ return nodeOp->hasNoSideEffect() && nodeOp->hasOneUse();
----------------
Nit: if you move this above the `if` you can use it in the if condition (and the if block becomes a one liner)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D75476/new/
https://reviews.llvm.org/D75476
More information about the llvm-commits
mailing list