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]};
}
void mlir::LLVM::ensureDistinctSuccessors(Operation *op) {
op->walk([](LLVMFuncOp f) {
- for (auto &bb : f.getBlocks()) {
+ for (auto &bb : f) {
::ensureDistinctSuccessors(bb);
}
});
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);
// 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);
}
// 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;