forked from OSchip/llvm-project
[MLIR][NFC] Eliminate .getBlocks() when not needed
Differential Revision: https://reviews.llvm.org/D82229
This commit is contained in:
parent
2565581e37
commit
d150662024
|
@ -219,19 +219,19 @@ void LaunchOp::build(OpBuilder &builder, OperationState &result,
|
|||
|
||||
KernelDim3 LaunchOp::getBlockIds() {
|
||||
assert(!body().empty() && "LaunchOp body must not be empty.");
|
||||
auto args = body().getBlocks().front().getArguments();
|
||||
auto args = body().front().getArguments();
|
||||
return KernelDim3{args[0], args[1], args[2]};
|
||||
}
|
||||
|
||||
KernelDim3 LaunchOp::getThreadIds() {
|
||||
assert(!body().empty() && "LaunchOp body must not be empty.");
|
||||
auto args = body().getBlocks().front().getArguments();
|
||||
auto args = body().front().getArguments();
|
||||
return KernelDim3{args[3], args[4], args[5]};
|
||||
}
|
||||
|
||||
KernelDim3 LaunchOp::getGridSize() {
|
||||
assert(!body().empty() && "LaunchOp body must not be empty.");
|
||||
auto args = body().getBlocks().front().getArguments();
|
||||
auto args = body().front().getArguments();
|
||||
return KernelDim3{args[6], args[7], args[8]};
|
||||
}
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ static void ensureDistinctSuccessors(Block &bb) {
|
|||
|
||||
void mlir::LLVM::ensureDistinctSuccessors(Operation *op) {
|
||||
op->walk([](LLVMFuncOp f) {
|
||||
for (auto &bb : f.getBlocks()) {
|
||||
for (auto &bb : f) {
|
||||
::ensureDistinctSuccessors(bb);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -167,7 +167,7 @@ static Error compileAndExecuteVoidFunction(
|
|||
Options &options, ModuleOp module, StringRef entryPoint,
|
||||
std::function<llvm::Error(llvm::Module *)> transformer) {
|
||||
auto mainFunction = module.lookupSymbol<LLVM::LLVMFuncOp>(entryPoint);
|
||||
if (!mainFunction || mainFunction.getBlocks().empty())
|
||||
if (!mainFunction || mainFunction.empty())
|
||||
return make_string_error("entry point not found");
|
||||
void *empty = nullptr;
|
||||
return compileAndExecute(options, module, entryPoint, transformer, &empty);
|
||||
|
|
|
@ -611,7 +611,7 @@ static llvm::SetVector<Block *> topologicalSort(LLVMFuncOp f) {
|
|||
// predecessors), add it to the list and traverse its successors in DFS
|
||||
// preorder.
|
||||
llvm::SetVector<Block *> blocks;
|
||||
for (Block &b : f.getBlocks()) {
|
||||
for (Block &b : f) {
|
||||
if (blocks.count(&b) == 0)
|
||||
topologicalSortImpl(blocks, &b);
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ static bool canBeHoisted(Operation *op,
|
|||
// Recurse into the regions for this op and check whether the contained ops
|
||||
// can be hoisted.
|
||||
for (auto ®ion : op->getRegions()) {
|
||||
for (auto &block : region.getBlocks()) {
|
||||
for (auto &block : region) {
|
||||
for (auto &innerOp : block.without_terminator())
|
||||
if (!canBeHoisted(&innerOp, definedOutside))
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue