// Hooks to customize behavior of this op.
static bool parse(OpAsmParser *parser, OperationState *result);
void print(OpAsmPrinter *p) const;
- bool verify() const;
/// Return the block this branch jumps to.
Block *getDest();
/// This is the base class for all of the MLIR function types.
class Function : public llvm::ilist_node_with_parent<Function, Module> {
public:
- enum class Kind { ExtFunc, CFGFunc, MLFunc };
-
- Function(Kind kind, Location location, StringRef name, FunctionType type,
+ Function(Location location, StringRef name, FunctionType type,
ArrayRef<NamedAttribute> attrs = {});
~Function();
- Kind getKind() const { return nameAndKind.getInt(); }
- void setKind(Kind kind) { nameAndKind.setInt(kind); }
-
- bool isCFG() const { return getKind() == Kind::CFGFunc; }
- bool isML() const { return getKind() == Kind::MLFunc; }
-
/// The source location the operation was defined or derived from.
Location getLoc() const { return location; }
/// Return the name of this function, without the @.
- Identifier getName() const { return nameAndKind.getPointer(); }
+ Identifier getName() const { return name; }
/// Return the type of this function.
FunctionType getType() const { return type; }
Module *getModule() { return module; }
const Module *getModule() const { return module; }
+ /// Add an entry block to an empty function, and set up the block arguments
+ /// to match the signature of the function.
+ void addEntryBlock();
+
/// Unlink this function from its module and delete it.
void erase();
void viewGraph() const;
private:
- /// The name of the function and the kind of function this is.
- llvm::PointerIntPair<Identifier, 2, Kind> nameAndKind;
+ /// The name of the function.
+ Identifier name;
/// The module this function is embedded into.
Module *module = nullptr;
llvm::PrettyStackTraceFormat fmt("MLIR Verifier: func @%s",
fn.getName().c_str());
- // If this is an external function, it must be empty.
- if (fn.getKind() == Function::Kind::ExtFunc) {
- if (!fn.empty())
- return failure("extfunc must not have any blocks", fn);
-
- // nothing else to check.
- return false;
- }
-
+ // External functions have nothing more to check.
if (fn.empty())
- return failure("function must have at least one block", fn);
-
- // ML Functions should have exactly one block.
- // TODO(clattner): This will change real soon now.
- if (fn.isML() && fn.getBlocks().size() != 1)
- return fn.emitError("mlfunc should have exactly one block");
+ return false;
// Verify the first block has no predecessors.
auto *firstBB = &fn.front();
}
void FunctionPrinter::printFunctionSignature() {
- switch (function->getKind()) {
- case Function::Kind::CFGFunc:
- os << "cfgfunc ";
- break;
- case Function::Kind::MLFunc:
- os << "mlfunc ";
- break;
- case Function::Kind::ExtFunc:
- os << "extfunc ";
- break;
- }
-
- os << '@' << function->getName() << '(';
+ os << "func @" << function->getName() << '(';
auto fnType = function->getType();
p->printSuccessorAndUseList(getInstruction(), 0);
}
-bool BranchOp::verify() const {
- // ML functions do not have branching terminators.
- if (getInstruction()->getFunction()->isML())
- return (emitOpError("cannot occur in a ML function"), true);
- return false;
-}
-
Block *BranchOp::getDest() { return getInstruction()->getSuccessor(0); }
void BranchOp::setDest(Block *block) {
}
bool CondBranchOp::verify() const {
- // ML functions do not have branching terminators.
- if (getInstruction()->getFunction()->isML())
- return (emitOpError("cannot occur in a ML function"), true);
if (!getCondition()->getType().isInteger(1))
return emitOpError("expected condition type was boolean (i1)");
return false;
#include "llvm/ADT/StringRef.h"
using namespace mlir;
-Function::Function(Kind kind, Location location, StringRef name,
- FunctionType type, ArrayRef<NamedAttribute> attrs)
- : nameAndKind(Identifier::get(name, type.getContext()), kind),
- location(location), type(type), blocks(this) {
+Function::Function(Location location, StringRef name, FunctionType type,
+ ArrayRef<NamedAttribute> attrs)
+ : name(Identifier::get(name, type.getContext())), location(location),
+ type(type), blocks(this) {
this->attrs = AttributeListStorage::get(attrs, getContext());
-
- // Creating of a Function automatically populates the entry block and
- // arguments.
- // TODO(clattner): Unify this behavior.
- if (kind == Kind::MLFunc) {
- // The body of an ML Function always has one block.
- auto *entry = new Block();
- blocks.push_back(entry);
-
- // Initialize the arguments.
- entry->addArguments(type.getInputs());
- }
}
Function::~Function() {
nameBuffer.resize(originalLength);
nameBuffer += '_';
nameBuffer += std::to_string(module->uniquingCounter++);
- function->nameAndKind.setPointer(
- Identifier::get(nameBuffer, module->getContext()));
+ function->name = Identifier::get(nameBuffer, module->getContext());
} while (
!module->symbolTable.insert({function->getName(), function}).second);
}
// Function implementation.
//===----------------------------------------------------------------------===//
+/// Add an entry block to an empty function, and set up the block arguments
+/// to match the signature of the function.
+void Function::addEntryBlock() {
+ assert(empty() && "function already has an entry block");
+ auto *entry = new Block();
+ push_back(entry);
+ entry->addArguments(type.getInputs());
+}
+
void Function::walkInsts(std::function<void(Instruction *)> callback) {
struct Walker : public InstWalker<Walker> {
std::function<void(Instruction *)> const &callback;
if (!function) {
auto &entry = state.functionForwardRefs[name];
if (!entry)
- entry = new Function(Function::Kind::ExtFunc,
- getEncodedSourceLocation(nameLoc), name, type,
+ entry = new Function(getEncodedSourceLocation(nameLoc), name, type,
/*attrs=*/{});
function = entry;
}
SmallVectorImpl<StringRef> &argNames);
ParseResult parseFunctionSignature(StringRef &name, FunctionType &type,
SmallVectorImpl<StringRef> &argNames);
- ParseResult parseFunc(Function::Kind kind);
+ ParseResult parseFunc();
};
} // end anonymous namespace
/// Function declarations.
///
-/// ext-func ::= `extfunc` function-signature function-attributes?
-//
-/// ml-func ::= `mlfunc` function-signature function-attributes?
-/// `{` inst* return-inst `}`
-///
-/// cfg-func ::= `cfgfunc` function-signature function-attributes?
-/// `{` basic-block+ `}`
-///
+/// func ::= `func` function-signature function-attributes? `{` block+ `}`
/// function-attributes ::= `attributes` attribute-dict
///
-ParseResult ModuleParser::parseFunc(Function::Kind kind) {
+ParseResult ModuleParser::parseFunc() {
consumeToken();
StringRef name;
// Okay, the function signature was parsed correctly, create the function now.
auto *function =
- new Function(kind, getEncodedSourceLocation(loc), name, type, attrs);
+ new Function(getEncodedSourceLocation(loc), name, type, attrs);
getModule()->getFunctions().push_back(function);
// Verify no name collision / redefinition.
"redefinition of function named '" + name.str() + "'");
// External functions have no body.
- if (kind == Function::Kind::ExtFunc)
+ if (getToken().isNot(Token::l_brace))
return ParseSuccess;
// Create the parser.
bool hadNamedArguments = !argNames.empty();
- // CFG functions don't auto-create a block, so create one now.
- // TODO(clattner): FIX THIS.
- if (kind == Function::Kind::CFGFunc) {
- auto *entry = new Block();
- function->push_back(entry);
- entry->addArguments(type.getInputs());
- }
+ // Add the entry block and argument list.
+ function->addEntryBlock();
// Add definitions of the function arguments.
if (hadNamedArguments) {
return ParseFailure;
break;
- case Token::kw_extfunc:
- if (parseFunc(Function::Kind::ExtFunc))
- return ParseFailure;
- break;
-
- case Token::kw_cfgfunc:
- if (parseFunc(Function::Kind::CFGFunc))
- return ParseFailure;
- break;
-
- case Token::kw_mlfunc:
- if (parseFunc(Function::Kind::MLFunc))
+ case Token::kw_func:
+ if (parseFunc())
return ParseFailure;
break;
}
TOK_KEYWORD(attributes)
TOK_KEYWORD(bf16)
TOK_KEYWORD(ceildiv)
-TOK_KEYWORD(cfgfunc)
TOK_KEYWORD(dense)
TOK_KEYWORD(else)
TOK_KEYWORD(splat)
-TOK_KEYWORD(extfunc)
TOK_KEYWORD(f16)
TOK_KEYWORD(f32)
TOK_KEYWORD(f64)
TOK_KEYWORD(false)
TOK_KEYWORD(floordiv)
TOK_KEYWORD(for)
+TOK_KEYWORD(func)
TOK_KEYWORD(if)
TOK_KEYWORD(index)
TOK_KEYWORD(max)
TOK_KEYWORD(memref)
TOK_KEYWORD(min)
-TOK_KEYWORD(mlfunc)
TOK_KEYWORD(mod)
TOK_KEYWORD(opaque)
TOK_KEYWORD(size)
else
lowerForInst(cast<ForInst>(inst));
- // Change the kind of the function to indicate it has no If's or For's.
- function->setKind(Function::Kind::CFGFunc);
return success();
}
#map52 = (d0) -> (16*d0 + ((d0 + 1) * -1) + 15)
// Single identity maps are removed.
-// CHECK: extfunc @f0(memref<2x4xi8, 1>)
-extfunc @f0(memref<2x4xi8, #map0, 1>)
+// CHECK: func @f0(memref<2x4xi8, 1>)
+func @f0(memref<2x4xi8, #map0, 1>)
// Single identity maps are removed.
-// CHECK: extfunc @f1(memref<2x4xi8, 1>)
-extfunc @f1(memref<2x4xi8, #map1, 1>)
+// CHECK: func @f1(memref<2x4xi8, 1>)
+func @f1(memref<2x4xi8, #map1, 1>)
-// CHECK: extfunc @f2(memref<i8, #map{{[0-9]+}}, 1>)
-extfunc @f2(memref<i8, #map2, 1>)
+// CHECK: func @f2(memref<i8, #map{{[0-9]+}}, 1>)
+func @f2(memref<i8, #map2, 1>)
-// CHECK: extfunc @f3(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f3(memref<2x4xi8, #map3, 1>)
-// CHECK: extfunc @f3a(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f3a(memref<2x4xi8, #map3a, 1>)
-// CHECK: extfunc @f3b(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f3b(memref<2x4xi8, #map3b, 1>)
-// CHECK: extfunc @f3c(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f3c(memref<2x4xi8, #map3c, 1>)
-// CHECK: extfunc @f3d(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f3d(memref<2x4xi8, #map3d, 1>)
-// CHECK: extfunc @f3e(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f3e(memref<2x4xi8, #map3e, 1>)
-// CHECK: extfunc @f3f(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f3f(memref<2x4xi8, #map3f, 1>)
-// CHECK: extfunc @f3g(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f3g(memref<2x4xi8, #map3g, 1>)
-// CHECK: extfunc @f3h(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f3h(memref<2x4xi8, #map3h, 1>)
-// CHECK: extfunc @f3i(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f3i(memref<2x4xi8, #map3i, 1>)
-// CHECK: extfunc @f3j(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f3j(memref<2x4xi8, #map3j, 1>)
-// CHECK: extfunc @f3k(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f3k(memref<2x4xi8, #map3k, 1>)
-// CHECK: extfunc @f3l(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f3l(memref<2x4xi8, #map3l, 1>)
+// CHECK: func @f3(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f3(memref<2x4xi8, #map3, 1>)
+// CHECK: func @f3a(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f3a(memref<2x4xi8, #map3a, 1>)
+// CHECK: func @f3b(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f3b(memref<2x4xi8, #map3b, 1>)
+// CHECK: func @f3c(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f3c(memref<2x4xi8, #map3c, 1>)
+// CHECK: func @f3d(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f3d(memref<2x4xi8, #map3d, 1>)
+// CHECK: func @f3e(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f3e(memref<2x4xi8, #map3e, 1>)
+// CHECK: func @f3f(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f3f(memref<2x4xi8, #map3f, 1>)
+// CHECK: func @f3g(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f3g(memref<2x4xi8, #map3g, 1>)
+// CHECK: func @f3h(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f3h(memref<2x4xi8, #map3h, 1>)
+// CHECK: func @f3i(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f3i(memref<2x4xi8, #map3i, 1>)
+// CHECK: func @f3j(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f3j(memref<2x4xi8, #map3j, 1>)
+// CHECK: func @f3k(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f3k(memref<2x4xi8, #map3k, 1>)
+// CHECK: func @f3l(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f3l(memref<2x4xi8, #map3l, 1>)
-// CHECK: extfunc @f4(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f4(memref<2x4xi8, #map4, 1>)
+// CHECK: func @f4(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f4(memref<2x4xi8, #map4, 1>)
-// CHECK: extfunc @f5(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f5(memref<2x4xi8, #map5, 1>)
+// CHECK: func @f5(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f5(memref<2x4xi8, #map5, 1>)
-// CHECK: extfunc @f6(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f6(memref<2x4xi8, #map6, 1>)
+// CHECK: func @f6(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f6(memref<2x4xi8, #map6, 1>)
-// CHECK: extfunc @f7(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f7(memref<2x4xi8, #map7, 1>)
+// CHECK: func @f7(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f7(memref<2x4xi8, #map7, 1>)
-// CHECK: extfunc @f8(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f8(memref<2x4xi8, #map8, 1>)
+// CHECK: func @f8(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f8(memref<2x4xi8, #map8, 1>)
-// CHECK: extfunc @f9(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f9(memref<2x4xi8, #map9, 1>)
+// CHECK: func @f9(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f9(memref<2x4xi8, #map9, 1>)
-// CHECK: extfunc @f10(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f10(memref<2x4xi8, #map10, 1>)
+// CHECK: func @f10(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f10(memref<2x4xi8, #map10, 1>)
-// CHECK: extfunc @f11(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f11(memref<2x4xi8, #map11, 1>)
+// CHECK: func @f11(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f11(memref<2x4xi8, #map11, 1>)
-// CHECK: extfunc @f12(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f12(memref<2x4xi8, #map12, 1>)
+// CHECK: func @f12(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f12(memref<2x4xi8, #map12, 1>)
-// CHECK: extfunc @f13(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f13(memref<2x4xi8, #map13, 1>)
+// CHECK: func @f13(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f13(memref<2x4xi8, #map13, 1>)
-// CHECK: extfunc @f14(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f14(memref<2x4xi8, #map14, 1>)
+// CHECK: func @f14(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f14(memref<2x4xi8, #map14, 1>)
-// CHECK: extfunc @f15(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f15(memref<2x4xi8, #map15, 1>)
+// CHECK: func @f15(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f15(memref<2x4xi8, #map15, 1>)
-// CHECK: extfunc @f16(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f16(memref<2x4xi8, #map16, 1>)
+// CHECK: func @f16(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f16(memref<2x4xi8, #map16, 1>)
-// CHECK: extfunc @f17(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f17(memref<2x4xi8, #map17, 1>)
+// CHECK: func @f17(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f17(memref<2x4xi8, #map17, 1>)
-// CHECK: extfunc @f19(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f19(memref<2x4xi8, #map19, 1>)
+// CHECK: func @f19(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f19(memref<2x4xi8, #map19, 1>)
-// CHECK: extfunc @f20(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f20(memref<2x4xi8, #map20, 1>)
+// CHECK: func @f20(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f20(memref<2x4xi8, #map20, 1>)
-// CHECK: extfunc @f18(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f18(memref<2x4xi8, #map18, 1>)
+// CHECK: func @f18(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f18(memref<2x4xi8, #map18, 1>)
-// CHECK: extfunc @f21(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f21(memref<2x4xi8, #map21, 1>)
+// CHECK: func @f21(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f21(memref<2x4xi8, #map21, 1>)
-// CHECK: extfunc @f22(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f22(memref<2x4xi8, #map22, 1>)
+// CHECK: func @f22(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f22(memref<2x4xi8, #map22, 1>)
-// CHECK: extfunc @f23(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f23(memref<2x4xi8, #map23, 1>)
+// CHECK: func @f23(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f23(memref<2x4xi8, #map23, 1>)
-// CHECK: extfunc @f24(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f24(memref<2x4xi8, #map24, 1>)
+// CHECK: func @f24(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f24(memref<2x4xi8, #map24, 1>)
-// CHECK: extfunc @f25(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f25(memref<2x4xi8, #map25, 1>)
+// CHECK: func @f25(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f25(memref<2x4xi8, #map25, 1>)
-// CHECK: extfunc @f26(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f26(memref<2x4xi8, #map26, 1>)
+// CHECK: func @f26(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f26(memref<2x4xi8, #map26, 1>)
-// CHECK: extfunc @f29(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f29(memref<2x4xi8, #map29, 1>)
+// CHECK: func @f29(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f29(memref<2x4xi8, #map29, 1>)
-// CHECK: extfunc @f30(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f30(memref<2x4xi8, #map30, 1>)
+// CHECK: func @f30(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f30(memref<2x4xi8, #map30, 1>)
-// CHECK: extfunc @f32(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f32(memref<2x4xi8, #map32, 1>)
+// CHECK: func @f32(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f32(memref<2x4xi8, #map32, 1>)
-// CHECK: extfunc @f33(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f33(memref<2x4xi8, #map33, 1>)
+// CHECK: func @f33(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f33(memref<2x4xi8, #map33, 1>)
-// CHECK: extfunc @f34(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f34(memref<2x4xi8, #map34, 1>)
+// CHECK: func @f34(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f34(memref<2x4xi8, #map34, 1>)
-// CHECK: extfunc @f35(memref<2x4x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f35(memref<2x4x4xi8, #map35, 1>)
+// CHECK: func @f35(memref<2x4x4xi8, #map{{[0-9]+}}, 1>)
+func @f35(memref<2x4x4xi8, #map35, 1>)
-// CHECK: extfunc @f36(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f36(memref<2x4xi8, #map36, 1>)
+// CHECK: func @f36(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f36(memref<2x4xi8, #map36, 1>)
-// CHECK: extfunc @f37(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f37(memref<2x4xi8, #map37, 1>)
+// CHECK: func @f37(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f37(memref<2x4xi8, #map37, 1>)
-// CHECK: extfunc @f38(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f38(memref<2x4xi8, #map38, 1>)
+// CHECK: func @f38(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f38(memref<2x4xi8, #map38, 1>)
-// CHECK: extfunc @f39(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f39(memref<2x4xi8, #map39, 1>)
+// CHECK: func @f39(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f39(memref<2x4xi8, #map39, 1>)
-// CHECK: extfunc @f40(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f40(memref<2x4xi8, #map40, 1>)
+// CHECK: func @f40(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f40(memref<2x4xi8, #map40, 1>)
-// CHECK: extfunc @f41(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f41(memref<2x4xi8, #map41, 1>)
+// CHECK: func @f41(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f41(memref<2x4xi8, #map41, 1>)
-// CHECK: extfunc @f42(memref<2x4xi8, #map{{[0-9]+}}, 1>)
-extfunc @f42(memref<2x4xi8, #map42, 1>)
+// CHECK: func @f42(memref<2x4xi8, #map{{[0-9]+}}, 1>)
+func @f42(memref<2x4xi8, #map42, 1>)
-// CHECK: extfunc @f43(memref<2x4xi8, #map{{[0-9]+}}>)
-extfunc @f43(memref<2x4xi8, #map43>)
+// CHECK: func @f43(memref<2x4xi8, #map{{[0-9]+}}>)
+func @f43(memref<2x4xi8, #map43>)
-// CHECK: extfunc @f44(memref<2x4xi8, #map{{[0-9]+}}>)
-extfunc @f44(memref<2x4xi8, #map44>)
+// CHECK: func @f44(memref<2x4xi8, #map{{[0-9]+}}>)
+func @f44(memref<2x4xi8, #map44>)
-// CHECK: extfunc @f45(memref<100x100x100xi8, #map{{[0-9]+}}>)
-extfunc @f45(memref<100x100x100xi8, #map45>)
+// CHECK: func @f45(memref<100x100x100xi8, #map{{[0-9]+}}>)
+func @f45(memref<100x100x100xi8, #map45>)
-// CHECK: extfunc @f46(memref<100x100x100xi8, #map{{[0-9]+}}>)
-extfunc @f46(memref<100x100x100xi8, #map46>)
+// CHECK: func @f46(memref<100x100x100xi8, #map{{[0-9]+}}>)
+func @f46(memref<100x100x100xi8, #map46>)
-// CHECK: extfunc @f47(memref<100x100x100xi8, #map{{[0-9]+}}>)
-extfunc @f47(memref<100x100x100xi8, #map47>)
+// CHECK: func @f47(memref<100x100x100xi8, #map{{[0-9]+}}>)
+func @f47(memref<100x100x100xi8, #map47>)
-// CHECK: extfunc @f48(memref<100x100x100xi8, #map{{[0-9]+}}>)
-extfunc @f48(memref<100x100x100xi8, #map48>)
+// CHECK: func @f48(memref<100x100x100xi8, #map{{[0-9]+}}>)
+func @f48(memref<100x100x100xi8, #map48>)
-// CHECK: extfunc @f49(memref<100x100xi8, #map{{[0-9]+}}>)
-extfunc @f49(memref<100x100xi8, #map49>)
+// CHECK: func @f49(memref<100x100xi8, #map{{[0-9]+}}>)
+func @f49(memref<100x100xi8, #map49>)
-// CHECK: extfunc @f50(memref<100x100xi8, #map{{[0-9]+}}>)
-extfunc @f50(memref<100x100xi8, #map50>)
+// CHECK: func @f50(memref<100x100xi8, #map{{[0-9]+}}>)
+func @f50(memref<100x100xi8, #map50>)
-// CHECK: extfunc @f51(memref<1xi8, #map{{[0-9]+}}>)
-extfunc @f51(memref<1xi8, #map51>)
+// CHECK: func @f51(memref<1xi8, #map{{[0-9]+}}>)
+func @f51(memref<1xi8, #map51>)
-// CHECK: extfunc @f52(memref<1xi8, #map{{[0-9]+}}>)
-extfunc @f52(memref<1xi8, #map52>)
+// CHECK: func @f52(memref<1xi8, #map{{[0-9]+}}>)
+func @f52(memref<1xi8, #map52>)
// CHECK-DAG: #[[map_proj_d0d1_d1:map[0-9]+]] = (d0, d1) -> (d1)
// CHECK-DAG: #[[map_proj_d0d1_d1d0:map[0-9]+]] = (d0, d1) -> (d1, d0)
-// CHECK-LABEL: cfgfunc @cfgfunc_with_ops(%arg0: f32) {
-cfgfunc @cfgfunc_with_ops(f32) {
+// CHECK-LABEL: func @func_with_ops(%arg0: f32) {
+func @func_with_ops(f32) {
^bb0(%a : f32):
// CHECK: %0 = "getTensor"() : () -> tensor<4x4x?xf32>
%t = "getTensor"() : () -> tensor<4x4x?xf32>
return
}
-// CHECK-LABEL: cfgfunc @standard_instrs(%arg0: tensor<4x4x?xf32>, %arg1: f32, %arg2: i32, %arg3: index) {
-cfgfunc @standard_instrs(tensor<4x4x?xf32>, f32, i32, index) {
+// CHECK-LABEL: func @standard_instrs(%arg0: tensor<4x4x?xf32>, %arg1: f32, %arg2: i32, %arg3: index) {
+func @standard_instrs(tensor<4x4x?xf32>, f32, i32, index) {
^bb42(%t: tensor<4x4x?xf32>, %f: f32, %i: i32, %idx : index):
// CHECK: %0 = dim %arg0, 2 : tensor<4x4x?xf32>
%a = "dim"(%t){index: 2} : (tensor<4x4x?xf32>) -> index
// CHECK: %cst = constant 4.300000e+01 : bf16
%9 = constant 43.0 : bf16
- // CHECK: %f = constant @cfgfunc_with_ops : (f32) -> ()
- %10 = constant @cfgfunc_with_ops : (f32) -> ()
+ // CHECK: %f = constant @func_with_ops : (f32) -> ()
+ %10 = constant @func_with_ops : (f32) -> ()
// CHECK: %f_1 = constant @affine_apply : () -> ()
%11 = constant @affine_apply : () -> ()
return
}
-// CHECK-LABEL: cfgfunc @affine_apply() {
-cfgfunc @affine_apply() {
+// CHECK-LABEL: func @affine_apply() {
+func @affine_apply() {
%i = "constant"() {value: 0: index} : () -> index
%j = "constant"() {value: 1: index} : () -> index
return
}
-// CHECK-LABEL: cfgfunc @load_store
-cfgfunc @load_store(memref<4x4xi32>, index) {
+// CHECK-LABEL: func @load_store
+func @load_store(memref<4x4xi32>, index) {
^bb0(%0: memref<4x4xi32>, %1: index):
// CHECK: %0 = load %arg0[%arg1, %arg1] : memref<4x4xi32>
%2 = "load"(%0, %1, %1) : (memref<4x4xi32>, index, index)->i32
return
}
-// CHECK-LABEL: mlfunc @return_op(%arg0: i32) -> i32 {
-mlfunc @return_op(%a : i32) -> i32 {
+// CHECK-LABEL: func @return_op(%arg0: i32) -> i32 {
+func @return_op(%a : i32) -> i32 {
// CHECK: return %arg0 : i32
"return" (%a) : (i32)->()
}
-// CHECK-LABEL: mlfunc @calls(%arg0: i32) {
-mlfunc @calls(%arg0: i32) {
+// CHECK-LABEL: func @calls(%arg0: i32) {
+func @calls(%arg0: i32) {
// CHECK: %0 = call @return_op(%arg0) : (i32) -> i32
%x = call @return_op(%arg0) : (i32) -> i32
// CHECK: %1 = call @return_op(%0) : (i32) -> i32
return
}
-// CHECK-LABEL: mlfunc @extract_element(%arg0: tensor<*xi32>, %arg1: tensor<4x4xf32>) -> i32 {
-mlfunc @extract_element(%arg0: tensor<*xi32>, %arg1 : tensor<4x4xf32>) -> i32 {
+// CHECK-LABEL: func @extract_element(%arg0: tensor<*xi32>, %arg1: tensor<4x4xf32>) -> i32 {
+func @extract_element(%arg0: tensor<*xi32>, %arg1 : tensor<4x4xf32>) -> i32 {
%c0 = "constant"() {value: 0: index} : () -> index
// CHECK: %0 = extract_element %arg0[%c0, %c0, %c0, %c0] : tensor<*xi32>
return %0 : i32
}
-// CHECK-LABEL: mlfunc @tensor_cast(%arg0
-mlfunc @tensor_cast(%arg0: tensor<*xf32>, %arg1 : tensor<4x4xf32>, %arg2: tensor<?x?xf32>) {
+// CHECK-LABEL: func @tensor_cast(%arg0
+func @tensor_cast(%arg0: tensor<*xf32>, %arg1 : tensor<4x4xf32>, %arg2: tensor<?x?xf32>) {
// CHECK: %0 = tensor_cast %arg0 : tensor<*xf32> to tensor<?x?xf32>
%0 = tensor_cast %arg0 : tensor<*xf32> to tensor<?x?xf32>
return
}
-// CHECK-LABEL: mlfunc @memref_cast(%arg0
-mlfunc @memref_cast(%arg0: memref<4xf32>, %arg1 : memref<?xf32>) {
+// CHECK-LABEL: func @memref_cast(%arg0
+func @memref_cast(%arg0: memref<4xf32>, %arg1 : memref<?xf32>) {
// CHECK: %0 = memref_cast %arg0 : memref<4xf32> to memref<?xf32>
%0 = memref_cast %arg0 : memref<4xf32> to memref<?xf32>
return
}
-// CHECK-LABEL: mlfunc @test_dimop(%arg0
-mlfunc @test_dimop(%arg0: tensor<4x4x?xf32>) {
+// CHECK-LABEL: func @test_dimop(%arg0
+func @test_dimop(%arg0: tensor<4x4x?xf32>) {
// CHECK: %0 = dim %arg0, 2 : tensor<4x4x?xf32>
%0 = dim %arg0, 2 : tensor<4x4x?xf32>
// use dim as an affine_int to ensure type correctness
}
-// CHECK-LABEL: mlfunc @test_vector_transfer_ops(%arg0
-mlfunc @test_vector_transfer_ops(%arg0: memref<?x?xf32>) {
+// CHECK-LABEL: func @test_vector_transfer_ops(%arg0
+func @test_vector_transfer_ops(%arg0: memref<?x?xf32>) {
%c3 = constant 3 : index
%cst = constant 3.0 : f32
// CHECK: %0 = vector_transfer_read %arg0, %c3, %c3 {permutation_map: #[[map_proj_d0d1_d0]]} : (memref<?x?xf32>, index, index) -> vector<128xf32>
// RUN: mlir-opt %s -split-input-file -verify
-cfgfunc @dim(tensor<1xf32>) {
+func @dim(tensor<1xf32>) {
^bb(%0: tensor<1xf32>):
"dim"(%0){index: "xyz"} : (tensor<1xf32>)->i32 // expected-error {{'dim' op requires an integer attribute named 'index'}}
return
// -----
-cfgfunc @dim2(tensor<1xf32>) {
+func @dim2(tensor<1xf32>) {
^bb(%0: tensor<1xf32>):
"dim"(){index: "xyz"} : ()->i32 // expected-error {{'dim' op requires a single operand}}
return
// -----
-cfgfunc @dim3(tensor<1xf32>) {
+func @dim3(tensor<1xf32>) {
^bb(%0: tensor<1xf32>):
"dim"(%0){index: 1} : (tensor<1xf32>)->i32 // expected-error {{'dim' op index is out of range}}
return
// -----
-cfgfunc @constant() {
+func @constant() {
^bb:
%x = "constant"(){value: "xyz"} : () -> i32 // expected-error {{'constant' op requires 'value' to be an integer for an integer result type}}
return
// -----
-cfgfunc @constant_out_of_range() {
+func @constant_out_of_range() {
^bb:
%x = "constant"(){value: 100} : () -> i1 // expected-error {{'constant' op requires 'value' to be an integer within the range of the integer result type}}
return
// -----
-cfgfunc @affine_apply_no_map() {
+func @affine_apply_no_map() {
^bb0:
%i = "constant"() {value: 0} : () -> index
%x = "affine_apply" (%i) { } : (index) -> (index) // expected-error {{'affine_apply' op requires an affine map}}
// -----
-cfgfunc @affine_apply_wrong_operand_count() {
+func @affine_apply_wrong_operand_count() {
^bb0:
%i = "constant"() {value: 0} : () -> index
%x = "affine_apply" (%i) {map: (d0, d1) -> ((d0 + 1), (d1 + 2))} : (index) -> (index) // expected-error {{'affine_apply' op operand count and affine map dimension and symbol count must match}}
// -----
-cfgfunc @affine_apply_wrong_result_count() {
+func @affine_apply_wrong_result_count() {
^bb0:
%i = "constant"() {value: 0} : () -> index
%j = "constant"() {value: 1} : () -> index
// -----
-cfgfunc @unknown_custom_op() {
+func @unknown_custom_op() {
^bb0:
%i = crazyThing() {value: 0} : () -> index // expected-error {{custom op 'crazyThing' is unknown}}
return
// -----
-cfgfunc @bad_alloc_wrong_dynamic_dim_count() {
+func @bad_alloc_wrong_dynamic_dim_count() {
^bb0:
%0 = "constant"() {value: 7} : () -> index
// Test alloc with wrong number of dynamic dimensions.
// -----
-cfgfunc @bad_alloc_wrong_symbol_count() {
+func @bad_alloc_wrong_symbol_count() {
^bb0:
%0 = "constant"() {value: 7} : () -> index
// Test alloc with wrong number of symbols
// -----
-cfgfunc @test_store_zero_results() {
+func @test_store_zero_results() {
^bb0:
%0 = alloc() : memref<1024x64xf32, (d0, d1) -> (d0, d1), 1>
%1 = "constant"() {value: 0} : () -> index
// -----
-mlfunc @test_store_zero_results2(%x: i32, %p: memref<i32>) {
+func @test_store_zero_results2(%x: i32, %p: memref<i32>) {
"store"(%x,%p) : (i32, memref<i32>) -> i32 // expected-error {{'store' op requires zero results}}
return
}
// -----
-cfgfunc @test_alloc_memref_map_rank_mismatch() {
+func @test_alloc_memref_map_rank_mismatch() {
^bb0:
%0 = alloc() : memref<1024x64xf32, (d0) -> (d0), 1> // expected-error {{memref affine map dimension mismatch}}
return
// -----
-cfgfunc @intlimit2() {
+func @intlimit2() {
^bb:
%0 = "constant"() {value: 0} : () -> i4096
%1 = "constant"() {value: 1} : () -> i4097 // expected-error {{integer bitwidth is limited to 4096 bits}}
// -----
-mlfunc @mlfunc_constant() {
+func @func_constant() {
%x = "constant"(){value: "xyz"} : () -> i32 // expected-error {{'constant' op requires 'value' to be an integer for an integer result type}}
return
}
// -----
-mlfunc @mlfunc_constant_out_of_range() {
+func @func_constant_out_of_range() {
%x = "constant"(){value: 100} : () -> i1 // expected-error {{'constant' op requires 'value' to be an integer within the range of the integer result type}}
return
}
// -----
-mlfunc @calls(%arg0: i32) {
+func @calls(%arg0: i32) {
%x = call @calls() : () -> i32 // expected-error {{reference to function with mismatched type}}
return
}
// -----
-cfgfunc @cfgfunc_with_ops(f32) {
+func @func_with_ops(f32) {
^bb0(%a : f32):
%sf = addf %a, %a, %a : f32 // expected-error {{custom op 'addf' expected 2 operands}}
}
// -----
-cfgfunc @cfgfunc_with_ops(f32) {
+func @func_with_ops(f32) {
^bb0(%a : f32):
%sf = addf(%a, %a) : f32 // expected-error {{unexpected delimiter}}
}
// -----
-cfgfunc @cfgfunc_with_ops(f32) {
+func @func_with_ops(f32) {
^bb0(%a : f32):
%sf = addf{%a, %a} : f32 // expected-error {{invalid operand}}
}
// -----
-cfgfunc @cfgfunc_with_ops(i32) {
+func @func_with_ops(i32) {
^bb0(%a : i32):
%sf = addf %a, %a : i32 // expected-error {{'addf' op requires a floating point type}}
}
// -----
-cfgfunc @cfgfunc_with_ops(i32) {
+func @func_with_ops(i32) {
^bb0(%a : i32):
// expected-error@+1 {{'predicate' attribute value out of range}}
%r = "cmpi"(%a, %b) {predicate: 42} : (i32, i32) -> i1
// -----
// Comparison are defined for arguments of the same type.
-cfgfunc @cfgfunc_with_ops(i32, i64) {
+func @func_with_ops(i32, i64) {
^bb0(%a : i32, %b : i64): // expected-error {{prior use here}}
%r = cmpi "eq", %a, %b : i32 // expected-error {{use of value '%b' expects different type than prior uses}}
}
// -----
// Comparisons must have the "predicate" attribute.
-cfgfunc @cfgfunc_with_ops(i32, i32) {
+func @func_with_ops(i32, i32) {
^bb0(%a : i32, %b : i32):
%r = cmpi %a, %b : i32 // expected-error {{expected type}}
}
// -----
// Integer comparisons are not recognized for float types.
-cfgfunc @cfgfunc_with_ops(f32, f32) {
+func @func_with_ops(f32, f32) {
^bb0(%a : f32, %b : f32):
%r = cmpi "eq", %a, %b : f32 // expected-error {{op requires an integer or index type}}
}
// -----
// Result type must be boolean like.
-cfgfunc @cfgfunc_with_ops(i32, i32) {
+func @func_with_ops(i32, i32) {
^bb0(%a : i32, %b : i32):
%r = "cmpi"(%a, %b) {predicate: 0} : (i32, i32) -> i32 // expected-error {{op requires a bool result type}}
}
// -----
-cfgfunc @cfgfunc_with_ops(i32, i32) {
+func @func_with_ops(i32, i32) {
^bb0(%a : i32, %b : i32):
// expected-error@+1 {{requires an integer attribute named 'predicate'}}
%r = "cmpi"(%a, %b) {foo: 1} : (i32, i32) -> i1
// -----
-cfgfunc @cfgfunc_with_ops() {
+func @func_with_ops() {
^bb0:
%c = constant splat<vector<42 x i32>, 0> : vector<42 x i32>
// expected-error@+1 {{op requires the same shape for all operands and results}}
// -----
-cfgfunc @cfgfunc_with_ops(i32, i32, i32) {
+func @func_with_ops(i32, i32, i32) {
^bb0(%cond : i32, %t : i32, %f : i32):
// expected-error@+2 {{different type than prior uses}}
// expected-error@-2 {{prior use here}}
// -----
-cfgfunc @cfgfunc_with_ops(i32, i32, i32) {
+func @func_with_ops(i32, i32, i32) {
^bb0(%cond : i32, %t : i32, %f : i32):
// expected-error@+1 {{elemental type i1}}
%r = "select"(%cond, %t, %f) : (i32, i32, i32) -> i32
// -----
-cfgfunc @cfgfunc_with_ops(i1, i32, i64) {
+func @func_with_ops(i1, i32, i64) {
^bb0(%cond : i1, %t : i32, %f : i64):
// expected-error@+1 {{'true' and 'false' arguments to be of the same type}}
%r = "select"(%cond, %t, %f) : (i1, i32, i64) -> i32
// -----
-cfgfunc @cfgfunc_with_ops(i1, vector<42xi32>, vector<42xi32>) {
+func @func_with_ops(i1, vector<42xi32>, vector<42xi32>) {
^bb0(%cond : i1, %t : vector<42xi32>, %f : vector<42xi32>):
// expected-error@+1 {{requires the condition to have the same shape as arguments}}
%r = "select"(%cond, %t, %f) : (i1, vector<42xi32>, vector<42xi32>) -> vector<42xi32>
// -----
-cfgfunc @cfgfunc_with_ops(i1, tensor<42xi32>, tensor<?xi32>) {
+func @func_with_ops(i1, tensor<42xi32>, tensor<?xi32>) {
^bb0(%cond : i1, %t : tensor<42xi32>, %f : tensor<?xi32>):
// expected-error@+1 {{'true' and 'false' arguments to be of the same type}}
%r = "select"(%cond, %t, %f) : (i1, tensor<42xi32>, tensor<?xi32>) -> tensor<42xi32>
// -----
-cfgfunc @cfgfunc_with_ops(tensor<?xi1>, tensor<42xi32>, tensor<42xi32>) {
+func @func_with_ops(tensor<?xi1>, tensor<42xi32>, tensor<42xi32>) {
^bb0(%cond : tensor<?xi1>, %t : tensor<42xi32>, %f : tensor<42xi32>):
// expected-error@+1 {{requires the condition to have the same shape as arguments}}
%r = "select"(%cond, %t, %f) : (tensor<?xi1>, tensor<42xi32>, tensor<42xi32>) -> tensor<42xi32>
// -----
-cfgfunc @test_vector_transfer_read(memref<?x?xf32>) {
+func @test_vector_transfer_read(memref<?x?xf32>) {
^bb0(%arg0: memref<?x?xf32>):
%c3 = constant 3 : index
%cst = constant 3.0 : f32
// -----
-cfgfunc @test_vector_transfer_read(memref<?x?xf32>) {
+func @test_vector_transfer_read(memref<?x?xf32>) {
^bb0(%arg0: memref<?x?xf32>):
%c3 = constant 3 : index
%cst = constant 3.0 : f32
// -----
-cfgfunc @test_vector_transfer_read(memref<?x?xf32>) {
+func @test_vector_transfer_read(memref<?x?xf32>) {
^bb0(%arg0: memref<?x?xf32>):
%c3 = constant 3 : index
%cst = constant 3.0 : f32
// -----
-cfgfunc @test_vector_transfer_read(memref<?x?xf32>) {
+func @test_vector_transfer_read(memref<?x?xf32>) {
^bb0(%arg0: memref<?x?xf32>):
%c3 = constant 3 : index
%cst = constant 3.0 : f32
// -----
-cfgfunc @test_vector_transfer_read(memref<?x?xf32>) {
+func @test_vector_transfer_read(memref<?x?xf32>) {
^bb0(%arg0: memref<?x?xf32>):
%c3 = constant 3 : index
%cst = constant 3.0 : f32
// -----
-cfgfunc @test_vector_transfer_read(memref<?x?xf32>) {
+func @test_vector_transfer_read(memref<?x?xf32>) {
^bb0(%arg0: memref<?x?xf32>):
%c3 = constant 3 : index
%cst = constant 3.0 : f32
// -----
-cfgfunc @test_vector_transfer_read(memref<?x?xf32>) {
+func @test_vector_transfer_read(memref<?x?xf32>) {
^bb0(%arg0: memref<?x?xf32>):
%c3 = constant 3 : index
%cst = constant 3.0 : f32
// -----
-cfgfunc @test_vector_transfer_read(memref<?x?xf32>) {
+func @test_vector_transfer_read(memref<?x?xf32>) {
^bb0(%arg0: memref<?x?xf32>):
%c3 = constant 3 : index
%cst = constant 3.0 : f32
}
// -----
-cfgfunc @test_vector_transfer_read(memref<?x?x?xf32>) {
+func @test_vector_transfer_read(memref<?x?x?xf32>) {
^bb0(%arg0: memref<?x?x?xf32>):
%c3 = constant 3 : index
%cst = constant 3.0 : f32
// -----
-cfgfunc @test_vector_transfer_write(memref<?x?xf32>) {
+func @test_vector_transfer_write(memref<?x?xf32>) {
^bb0(%arg0: memref<?x?xf32>):
%c3 = constant 3 : index
%cst = constant splat<vector<128 x f32>, 3.0> : vector<128 x f32>
// -----
-cfgfunc @test_vector_transfer_write(memref<?x?xf32>) {
+func @test_vector_transfer_write(memref<?x?xf32>) {
^bb0(%arg0: memref<?x?xf32>):
%c3 = constant 3 : index
%cst = constant splat<vector<128 x f32>, 3.0> : vector<128 x f32>
// -----
-cfgfunc @test_vector_transfer_write(memref<?x?xf32>) {
+func @test_vector_transfer_write(memref<?x?xf32>) {
^bb0(%arg0: memref<?x?xf32>):
%c3 = constant 3 : index
%cst = constant splat<vector<128 x f32>, 3.0> : vector<128 x f32>
// -----
-cfgfunc @test_vector_transfer_write(memref<?x?xf32>) {
+func @test_vector_transfer_write(memref<?x?xf32>) {
^bb0(%arg0: memref<?x?xf32>):
%c3 = constant 3 : index
%cst = constant splat<vector<128 x f32>, 3.0> : vector<128 x f32>
// -----
-cfgfunc @test_vector_transfer_write(memref<?x?xf32>) {
+func @test_vector_transfer_write(memref<?x?xf32>) {
^bb0(%arg0: memref<?x?xf32>):
%c3 = constant 3 : index
%cst = constant splat<vector<128 x f32>, 3.0> : vector<128 x f32>
// -----
-cfgfunc @test_vector_transfer_write(memref<?x?xf32>) {
+func @test_vector_transfer_write(memref<?x?xf32>) {
^bb0(%arg0: memref<?x?xf32>):
%c3 = constant 3 : index
%cst = constant splat<vector<128 x f32>, 3.0> : vector<128 x f32>
// -----
-cfgfunc @test_vector_transfer_write(memref<?x?xf32>) {
+func @test_vector_transfer_write(memref<?x?xf32>) {
^bb0(%arg0: memref<?x?xf32>):
%c3 = constant 3 : index
%cst = constant splat<vector<128 x f32>, 3.0> : vector<128 x f32>
// -----
-cfgfunc @test_vector_transfer_write(memref<?x?xf32>) {
+func @test_vector_transfer_write(memref<?x?xf32>) {
^bb0(%arg0: memref<?x?xf32>):
%c3 = constant 3 : index
%cst = constant splat<vector<128 x f32>, 3.0> : vector<128 x f32>
}
// -----
-cfgfunc @test_vector_transfer_write(memref<?x?x?xf32>) {
+func @test_vector_transfer_write(memref<?x?x?xf32>) {
^bb0(%arg0: memref<?x?x?xf32>):
%c3 = constant 3 : index
%cst = constant splat<vector<3 x 7 x f32>, 3.0> : vector<3 x 7 x f32>
// Check different error cases.
// -----
-extfunc @illegaltype(i) // expected-error {{expected type}}
+func @illegaltype(i) // expected-error {{expected type}}
// -----
-mlfunc @illegaltype() {
+func @illegaltype() {
%0 = constant splat<<vector 4 x f32>, 0> : vector<4 x f32> // expected-error {{expected type}}
}
// -----
-extfunc @nestedtensor(tensor<tensor<i8>>) -> () // expected-error {{invalid tensor element type}}
+func @nestedtensor(tensor<tensor<i8>>) -> () // expected-error {{invalid tensor element type}}
// -----
-extfunc @indexvector(vector<4 x index>) -> () // expected-error {{vector elements must be int or float type}}
+func @indexvector(vector<4 x index>) -> () // expected-error {{vector elements must be int or float type}}
// -----
-extfunc @indexmemref(memref<? x index>) -> () // expected-error {{invalid memref element type}}
+func @indexmemref(memref<? x index>) -> () // expected-error {{invalid memref element type}}
// -----
-extfunc @indextensor(tensor<4 x index>) -> () // expected-error {{invalid tensor element type}}
+func @indextensor(tensor<4 x index>) -> () // expected-error {{invalid tensor element type}}
// -----
// Test no map in memref type.
-extfunc @memrefs(memref<2x4xi8, >) // expected-error {{expected list element}}
+func @memrefs(memref<2x4xi8, >) // expected-error {{expected list element}}
// -----
// Test non-existent map in memref type.
-extfunc @memrefs(memref<2x4xi8, #map7>) // expected-error {{undefined affine map id 'map7'}}
+func @memrefs(memref<2x4xi8, #map7>) // expected-error {{undefined affine map id 'map7'}}
// -----
// Test non hash identifier in memref type.
-extfunc @memrefs(memref<2x4xi8, %map7>) // expected-error {{expected '(' at start of dimensional identifiers list}}
+func @memrefs(memref<2x4xi8, %map7>) // expected-error {{expected '(' at start of dimensional identifiers list}}
// -----
// Test non-existent map in map composition of memref type.
#map0 = (d0, d1) -> (d0, d1)
-extfunc @memrefs(memref<2x4xi8, #map0, #map8>) // expected-error {{undefined affine map id 'map8'}}
+func @memrefs(memref<2x4xi8, #map0, #map8>) // expected-error {{undefined affine map id 'map8'}}
// -----
// Test multiple memory space error.
#map0 = (d0, d1) -> (d0, d1)
-extfunc @memrefs(memref<2x4xi8, #map0, 1, 2>) // expected-error {{multiple memory spaces specified in memref type}}
+func @memrefs(memref<2x4xi8, #map0, 1, 2>) // expected-error {{multiple memory spaces specified in memref type}}
// -----
// Test affine map after memory space.
#map0 = (d0, d1) -> (d0, d1)
#map1 = (d0, d1) -> (d0, d1)
-extfunc @memrefs(memref<2x4xi8, #map0, 1, #map1>) // expected-error {{affine map after memory space in memref type}}
+func @memrefs(memref<2x4xi8, #map0, 1, #map1>) // expected-error {{affine map after memory space in memref type}}
// -----
// Test dimension mismatch between memref and layout map.
// The error must be emitted even for the trivial identity layout maps that are
// dropped in type creation.
#map0 = (d0, d1) -> (d0, d1)
-extfunc @memrefs(memref<42xi8, #map0>) // expected-error {{memref affine map dimension mismatch}}
+func @memrefs(memref<42xi8, #map0>) // expected-error {{memref affine map dimension mismatch}}
// -----
#map0 = (d0, d1) -> (d0, d1)
#map1 = (d0) -> (d0)
-extfunc @memrefs(memref<42x42xi8, #map0, #map1>) // expected-error {{memref affine map dimension mismatch}}
+func @memrefs(memref<42x42xi8, #map0, #map1>) // expected-error {{memref affine map dimension mismatch}}
// -----
-extfunc @illegalattrs() -> () attributes { key } // expected-error {{expected ':' in attribute list}}
+func @illegalattrs() -> () attributes { key } // expected-error {{expected ':' in attribute list}}
// -----
-cfgfunc @foo()
-cfgfunc @bar() // expected-error {{expected '{' in function}}
-
-// -----
-
-extfunc missingsigil() -> (i1, index, f32) // expected-error {{expected a function identifier like}}
+func missingsigil() -> (i1, index, f32) // expected-error {{expected a function identifier like}}
// -----
-cfgfunc @bad_branch() {
+func @bad_branch() {
^bb12:
br ^missing // expected-error {{reference to an undefined block}}
}
// -----
-cfgfunc @block_redef() {
+func @block_redef() {
^bb42:
return
^bb42: // expected-error {{redefinition of block '^bb42'}}
// -----
-cfgfunc @no_terminator() { // expected-error {{block with no terminator}}
+func @no_terminator() { // expected-error {{block with no terminator}}
^bb40:
return
^bb41:
// -----
-cfgfunc @block_no_rparen() {
+func @block_no_rparen() {
^bb42 (%bb42 : i32: // expected-error {{expected ')' to end argument list}}
return
}
// -----
-cfgfunc @block_arg_no_ssaid() {
+func @block_arg_no_ssaid() {
^bb42 (i32): // expected-error {{expected SSA operand}}
return
}
// -----
-cfgfunc @block_arg_no_type() {
+func @block_arg_no_type() {
^bb42 (%0): // expected-error {{expected ':' and type for SSA operand}}
return
}
// -----
-cfgfunc @block_arg_no_close_paren() {
+func @block_arg_no_close_paren() {
^bb42:
br ^bb2( // expected-error@+1 {{expected ')' to close argument list}}
return
// -----
-cfgfunc @block_first_has_predecessor() {
+func @block_first_has_predecessor() {
// expected-error@-1 {{entry block of function may not have predecessors}}
^bb42:
br ^bb43
// -----
-cfgfunc @illegalattrs() -> ()
+func @illegalattrs() -> ()
attributes { key } { // expected-error {{expected ':' in attribute list}}
^bb42:
return
// -----
-mlfunc @foo()
-mlfunc @bar() // expected-error {{expected '{' in function}}
-
-// -----
-
-mlfunc @empty() {
+func @empty() {
} // expected-error {{function must have a body}}
// -----
-mlfunc @illegalattrs() -> ()
+func @illegalattrs() -> ()
attributes { key } { // expected-error {{expected ':' in attribute list}}
^bb42:
return
// -----
-mlfunc @no_return() {
+func @no_return() {
"foo"() : () -> () // expected-error {{block with no terminator}}
}
// -----
-cfgfunc @bad_op_type() {
+func @bad_op_type() {
^bb40:
"foo"() : i32 // expected-error {{expected function type}}
return
}
// -----
-cfgfunc @no_terminator() {
+func @no_terminator() {
^bb40:
"foo"() : ()->()
""() : ()->() // expected-error {{empty operation name is invalid}}
// -----
-extfunc @illegaltype(i0) // expected-error {{invalid integer width}}
+func @illegaltype(i0) // expected-error {{invalid integer width}}
// -----
-mlfunc @malformed_for_percent() {
+func @malformed_for_percent() {
for i = 1 to 10 { // expected-error {{expected SSA identifier for the loop variable}}
// -----
-mlfunc @malformed_for_equal() {
+func @malformed_for_equal() {
for %i 1 to 10 { // expected-error {{expected '='}}
// -----
-mlfunc @malformed_for_to() {
+func @malformed_for_to() {
for %i = 1 too 10 { // expected-error {{expected 'to' between bounds}}
}
}
// -----
-mlfunc @incomplete_for() {
+func @incomplete_for() {
for %i = 1 to 10 step 2
} // expected-error {{expected '{' before instruction list}}
// -----
-mlfunc @nonconstant_step(%1 : i32) {
+func @nonconstant_step(%1 : i32) {
for %2 = 1 to 5 step %1 { // expected-error {{expected integer}}
// -----
-mlfunc @for_negative_stride() {
+func @for_negative_stride() {
for %i = 1 to 10 step -1
} // expected-error {{step has to be a positive integer}}
// -----
-mlfunc @non_instruction() {
+func @non_instruction() {
asd // expected-error {{custom op 'asd' is unknown}}
}
// -----
-mlfunc @invalid_if_conditional1() {
+func @invalid_if_conditional1() {
for %i = 1 to 10 {
if () { // expected-error {{expected ':' or '['}}
}
// -----
-mlfunc @invalid_if_conditional2() {
+func @invalid_if_conditional2() {
for %i = 1 to 10 {
if (i)[N] : (i >= ) // expected-error {{expected '== 0' or '>= 0' at end of affine constraint}}
}
// -----
-mlfunc @invalid_if_conditional3() {
+func @invalid_if_conditional3() {
for %i = 1 to 10 {
if (i)[N] : (i == 1) // expected-error {{expected '0' after '=='}}
}
// -----
-mlfunc @invalid_if_conditional4() {
+func @invalid_if_conditional4() {
for %i = 1 to 10 {
if (i)[N] : (i >= 2) // expected-error {{expected '0' after '>='}}
}
// -----
-mlfunc @invalid_if_conditional5() {
+func @invalid_if_conditional5() {
for %i = 1 to 10 {
if (i)[N] : (i <= 0 ) // expected-error {{expected '== 0' or '>= 0' at end of affine constraint}}
}
// -----
-mlfunc @invalid_if_conditional6() {
+func @invalid_if_conditional6() {
for %i = 1 to 10 {
if (i) : (i) // expected-error {{expected '== 0' or '>= 0' at end of affine constraint}}
}
// -----
// TODO (support if (1)?
-mlfunc @invalid_if_conditional7() {
+func @invalid_if_conditional7() {
for %i = 1 to 10 {
if (i) : (1) // expected-error {{expected '== 0' or '>= 0' at end of affine constraint}}
}
// -----
-cfgfunc @test() {
+func @test() {
^bb40:
%1 = "foo"() : (i32)->i64 // expected-error {{expected 0 operand types but had 1}}
return
// -----
-cfgfunc @redef() {
+func @redef() {
^bb42:
%x = "xxx"(){index: 0} : ()->i32 // expected-error {{previously defined here}}
%x = "xxx"(){index: 0} : ()->i32 // expected-error {{redefinition of SSA value '%x'}}
// -----
-cfgfunc @undef() {
+func @undef() {
^bb42:
%x = "xxx"(%y) : (i32)->i32 // expected-error {{use of undeclared SSA value}}
return
// -----
-mlfunc @missing_rbrace() {
+func @missing_rbrace() {
return
-mlfunc @d() {return} // expected-error {{custom op 'mlfunc' is unknown}}
+func @d() {return} // expected-error {{custom op 'func' is unknown}}
// -----
-mlfunc @malformed_type(%a : intt) { // expected-error {{expected type}}
+func @malformed_type(%a : intt) { // expected-error {{expected type}}
}
// -----
-cfgfunc @resulterror() -> i32 {
+func @resulterror() -> i32 {
^bb42:
return // expected-error {{'return' op has 0 operands, but enclosing function returns 1}}
}
// -----
-mlfunc @mlfunc_resulterror() -> i32 {
+func @func_resulterror() -> i32 {
return // expected-error {{'return' op has 0 operands, but enclosing function returns 1}}
}
// -----
-cfgfunc @argError() {
+func @argError() {
^bb1(%a: i64): // expected-error {{previously defined here}}
br ^bb2
^bb2(%a: i64): // expected-error{{redefinition of SSA value '%a'}}
// -----
-cfgfunc @bbargMismatch(i32, f32) {
+func @bbargMismatch(i32, f32) {
// expected-error @+1 {{argument and block argument type mismatch}}
^bb42(%0: f32):
return
// -----
-cfgfunc @br_mismatch() {
+func @br_mismatch() {
^bb0:
%0 = "foo"() : () -> (i1, i17)
// expected-error @+1 {{branch has 2 operands, but target block has 1}}
// -----
// Test no nested vector.
-extfunc @vectors(vector<1 x vector<1xi32>>, vector<2x4xf32>)
+func @vectors(vector<1 x vector<1xi32>>, vector<2x4xf32>)
// expected-error@-1 {{vector elements must be int or float type}}
// -----
-cfgfunc @condbr_notbool() {
+func @condbr_notbool() {
^bb0:
%a = "foo"() : () -> i32 // expected-error {{prior use here}}
cond_br %a, ^bb0, ^bb0 // expected-error {{use of value '%a' expects different type than prior uses}}
// -----
-cfgfunc @condbr_badtype() {
+func @condbr_badtype() {
^bb0:
%c = "foo"() : () -> i1
%a = "foo"() : () -> i32
// -----
-cfgfunc @condbr_a_bb_is_not_a_type() {
+func @condbr_a_bb_is_not_a_type() {
^bb0:
%c = "foo"() : () -> i1
%a = "foo"() : () -> i32
// -----
-cfgfunc @undef() {
+func @undef() {
^bb0:
%x = "xxx"(%y) : (i32)->i32 // expected-error {{use of undeclared SSA value name}}
return
// -----
-mlfunc @undef() {
+func @undef() {
%x = "xxx"(%y) : (i32)->i32 // expected-error {{use of undeclared SSA value name}}
return
}
// -----
-mlfunc @duplicate_induction_var() {
+func @duplicate_induction_var() {
for %i = 1 to 10 { // expected-error {{previously defined here}}
for %i = 1 to 10 { // expected-error {{redefinition of SSA value '%i'}}
}
// -----
-mlfunc @dominance_failure() {
+func @dominance_failure() {
for %i = 1 to 10 {
}
"xxx"(%i) : (index)->() // expected-error {{operand #0 does not dominate this use}}
// -----
-cfgfunc @dominance_failure() {
+func @dominance_failure() {
^bb0:
"foo"(%x) : (i32) -> () // expected-error {{operand #0 does not dominate this use}}
br ^bb1
// -----
-mlfunc @return_type_mismatch() -> i32 {
+func @return_type_mismatch() -> i32 {
%0 = "foo"() : ()->f32
return %0 : f32 // expected-error {{type of return operand 0 doesn't match function result type}}
}
// -----
-mlfunc @return_inside_loop() -> i8 {
+func @return_inside_loop() -> i8 {
for %i = 1 to 100 {
%a = "foo"() : ()->i8
return %a : i8
// -----
-extfunc @redef()
-extfunc @redef() // expected-error {{redefinition of function named 'redef'}}
+func @redef()
+func @redef() // expected-error {{redefinition of function named 'redef'}}
// -----
-cfgfunc @foo() {
+func @foo() {
^bb0:
%x = constant @foo : (i32) -> () // expected-error {{reference to function with mismatched type}}
return
// -----
-cfgfunc @undefined_function() {
+func @undefined_function() {
^bb0:
%x = constant @bar : (i32) -> () // expected-error {{reference to undefined function 'bar'}}
return
#map1 = (i)[j] -> (i+j)
-mlfunc @bound_symbol_mismatch(%N : index) {
+func @bound_symbol_mismatch(%N : index) {
for %i = #map1(%N) to 100 {
// expected-error@-1 {{symbol operand count and affine map symbol count must match}}
}
#map1 = (i)[j] -> (i+j)
-mlfunc @bound_dim_mismatch(%N : index) {
+func @bound_dim_mismatch(%N : index) {
for %i = #map1(%N, %N)[%N] to 100 {
// expected-error@-1 {{dim operand count and affine map dim count must match}}
}
#map1 = (i)[j] -> (i+j)
-mlfunc @invalid_dim_nested(%N : index) {
+func @invalid_dim_nested(%N : index) {
for %i = 1 to 100 {
%a = "foo"(%N) : (index)->(index)
for %j = 1 to #map1(%a)[%i] {
#map1 = (i)[j] -> (i+j)
-mlfunc @invalid_dim_affine_apply(%N : index) {
+func @invalid_dim_affine_apply(%N : index) {
for %i = 1 to 100 {
%a = "foo"(%N) : (index)->(index)
%w = affine_apply (i)->(i+1) (%a)
#map1 = (i)[j] -> (i+j)
-mlfunc @invalid_symbol_iv(%N : index) {
+func @invalid_symbol_iv(%N : index) {
for %i = 1 to 100 {
%a = "foo"(%N) : (index)->(index)
for %j = 1 to #map1(%N)[%i] {
#map1 = (i)[j] -> (i+j)
-mlfunc @invalid_symbol_nested(%N : index) {
+func @invalid_symbol_nested(%N : index) {
for %i = 1 to 100 {
%a = "foo"(%N) : (index)->(index)
for %j = 1 to #map1(%N)[%a] {
#map1 = (i)[j] -> (i+j)
-mlfunc @invalid_symbol_affine_apply(%N : index) {
+func @invalid_symbol_affine_apply(%N : index) {
for %i = 1 to 100 {
%w = affine_apply (i)->(i+1) (%i)
for %j = 1 to #map1(%i)[%w] {
// -----
-mlfunc @large_bound() {
+func @large_bound() {
for %i = 1 to 9223372036854775810 {
// expected-error@-1 {{bound or step is too large for index}}
}
// -----
-mlfunc @max_in_upper_bound(%N : index) {
+func @max_in_upper_bound(%N : index) {
for %i = 1 to max (i)->(N, 100) { //expected-error {{expected SSA operand}}
}
return
// -----
-mlfunc @step_typo() {
+func @step_typo() {
for %i = 1 to 100 step -- 1 { //expected-error {{expected integer}}
}
return
// -----
-mlfunc @invalid_bound_map(%N : i32) {
+func @invalid_bound_map(%N : i32) {
for %i = 1 to (i)->(j)(%N) { //expected-error {{use of undeclared identifier}}
}
return
// -----
#set0 = (i)[N] : (i >= 0, N - i >= 0)
-mlfunc @invalid_if_operands1(%N : index) {
+func @invalid_if_operands1(%N : index) {
for %i = 1 to 10 {
if #set0(%i) {
// expected-error@-1 {{symbol operand count and integer set symbol count must match}}
// -----
#set0 = (i)[N] : (i >= 0, N - i >= 0)
-mlfunc @invalid_if_operands2(%N : index) {
+func @invalid_if_operands2(%N : index) {
for %i = 1 to 10 {
if #set0()[%N] {
// expected-error@-1 {{dim operand count and integer set dim count must match}}
// -----
#set0 = (i)[N] : (i >= 0, N - i >= 0)
-mlfunc @invalid_if_operands3(%N : index) {
+func @invalid_if_operands3(%N : index) {
for %i = 1 to 10 {
if #set0(%i)[%i] {
// expected-error@-1 {{value '%i' cannot be used as a symbol}}
// -----
// expected-error@+1 {{expected '"' in string literal}}
"J// -----
-mlfunc @calls(%arg0: i32) {
+func @calls(%arg0: i32) {
// expected-error@+1 {{expected type}}
%z = "casdasda"(%x) : (ppop32) -> i32
}
// -----
// expected-error@+2 {{expected SSA operand}}
-cfgfunc@n(){^b(
+func@n(){^b(
// -----
-cfgfunc @elementsattr_non_tensor_type() -> () {
+func @elementsattr_non_tensor_type() -> () {
^bb0:
"foo"(){bar: dense<i32, [4]>} : () -> () // expected-error {{expected elements literal has a tensor or vector type}}
}
// -----
-cfgfunc @elementsattr_non_ranked() -> () {
+func @elementsattr_non_ranked() -> () {
^bb0:
"foo"(){bar: dense<tensor<?xi32>, [4]>} : () -> () // expected-error {{tensor literals must be ranked and have static shape}}
}
// -----
-cfgfunc @elementsattr_shape_mismatch() -> () {
+func @elementsattr_shape_mismatch() -> () {
^bb0:
"foo"(){bar: dense<tensor<5xi32>, [4]>} : () -> () // expected-error {{inferred shape of elements literal ([1]) does not match type ([5])}}
}
// -----
-cfgfunc @elementsattr_invalid() -> () {
+func @elementsattr_invalid() -> () {
^bb0:
"foo"(){bar: dense<tensor<2xi32>, [4, [5]]>} : () -> () // expected-error {{tensor literal is invalid; ranks are not consistent between elements}}
}
// -----
-cfgfunc @elementsattr_badtoken() -> () {
+func @elementsattr_badtoken() -> () {
^bb0:
"foo"(){bar: dense<tensor<1xi32>, [tf_opaque]>} : () -> () // expected-error {{expected '[' or scalar constant inside tensor literal}}
}
// -----
-cfgfunc @elementsattr_floattype1() -> () {
+func @elementsattr_floattype1() -> () {
^bb0:
// expected-error@+1 {{floating point value not valid for specified type}}
"foo"(){bar: dense<tensor<1xi32>, [4.0]>} : () -> ()
// -----
-cfgfunc @elementsattr_floattype2() -> () {
+func @elementsattr_floattype2() -> () {
^bb0:
// expected-error@+1 {{integer value not valid for specified type}}
"foo"(){bar: dense<tensor<1xf32>, [4]>} : () -> ()
// -----
-cfgfunc @elementsattr_toolarge1() -> () {
+func @elementsattr_toolarge1() -> () {
^bb0:
"foo"(){bar: dense<tensor<1xi8>, [777]>} : () -> () // expected-error {{integer constant out of range for attribute}}
}
// -----
-cfgfunc @elementsattr_toolarge2() -> () {
+func @elementsattr_toolarge2() -> () {
^bb0:
"foo"(){bar: dense<tensor<1xi8>, [-777]>} : () -> () // expected-error {{integer constant out of range for attribute}}
}
// -----
-cfgfunc @elementsattr_malformed_opaque() -> () {
+func @elementsattr_malformed_opaque() -> () {
^bb0:
"foo"(){bar: opaque<tensor<1xi8>, "0xQZz123">} : () -> () // expected-error {{opaque string only contains hex digits}}
}
// -----
-cfgfunc @elementsattr_malformed_opaque1() -> () {
+func @elementsattr_malformed_opaque1() -> () {
^bb0:
"foo"(){bar: opaque<tensor<1xi8>, "00abc">} : () -> () // expected-error {{opaque string should start with '0x'}}
}
// -----
-cfgfunc @redundant_signature(%a : i32) -> () {
+func @redundant_signature(%a : i32) -> () {
^bb0(%b : i32): // expected-error {{invalid block name in function with named arguments}}
return
}
// -----
-cfgfunc @mixed_named_arguments(%a : i32,
+func @mixed_named_arguments(%a : i32,
f32) -> () {
// expected-error @-1 {{expected SSA identifier}}
return
// -----
-cfgfunc @mixed_named_arguments(f32,
+func @mixed_named_arguments(f32,
%a : i32) -> () { // expected-error {{expected type instead of SSA identifier}}
return
}
-// -----
-
-mlfunc @multi_block(%N : index) { // expected-error {{mlfunc should have exactly one block}}
- for %i = 1 to %N {}
- return
-
-^bb42:
- return
-}
// CHECK: #map0 = (d0, d1)[s0] -> (d0 + s0, d1)
-// CHECK-LABEL: cfgfunc @alloc() {
-cfgfunc @alloc() {
+// CHECK-LABEL: func @alloc() {
+func @alloc() {
^bb0:
// Test simple alloc.
// CHECK: %0 = alloc() : memref<1024x64xf32, 1>
return
}
-// CHECK-LABEL: cfgfunc @dealloc() {
-cfgfunc @dealloc() {
+// CHECK-LABEL: func @dealloc() {
+func @dealloc() {
^bb0:
// CHECK: %0 = alloc() : memref<1024x64xf32>
%0 = alloc() : memref<1024x64xf32, (d0, d1) -> (d0, d1), 0>
return
}
-// CHECK-LABEL: cfgfunc @load_store
-cfgfunc @load_store() {
+// CHECK-LABEL: func @load_store
+func @load_store() {
^bb0:
// CHECK: %0 = alloc() : memref<1024x64xf32, 1>
%0 = alloc() : memref<1024x64xf32, (d0, d1) -> (d0, d1), 1>
return
}
-// CHECK-LABEL: mlfunc @dma_ops()
-mlfunc @dma_ops() {
+// CHECK-LABEL: func @dma_ops()
+func @dma_ops() {
%c0 = constant 0 : index
%stride = constant 32 : index
%elt_per_stride = constant 16 : index
// RUN: mlir-opt -print-op-stats %s -o=/dev/null 2>&1 | FileCheck %s
-cfgfunc @main(tensor<4xf32>, tensor<4xf32>) -> tensor<4xf32> {
+func @main(tensor<4xf32>, tensor<4xf32>) -> tensor<4xf32> {
^bb0(%arg0: tensor<4xf32>, %arg1: tensor<4xf32>):
%0 = addf %arg0, %arg1 : tensor<4xf32>
%1 = addf %arg0, %arg1 : tensor<4xf32>
// CHECK-DAG: #set{{[0-9]+}} = (d0)[s0] : (d0 - 2 >= 0, d0 * -1 + 4 >= 0)
-// CHECK: extfunc @foo(i32, i64) -> f32
-extfunc @foo(i32, i64) -> f32
+// CHECK: func @foo(i32, i64) -> f32
+func @foo(i32, i64) -> f32
-// CHECK: extfunc @bar()
-extfunc @bar() -> ()
+// CHECK: func @bar()
+func @bar() -> ()
-// CHECK: extfunc @baz() -> (i1, index, f32)
-extfunc @baz() -> (i1, index, f32)
+// CHECK: func @baz() -> (i1, index, f32)
+func @baz() -> (i1, index, f32)
-// CHECK: extfunc @missingReturn()
-extfunc @missingReturn()
+// CHECK: func @missingReturn()
+func @missingReturn()
-// CHECK: extfunc @int_types(i1, i2, i4, i7, i87) -> (i1, index, i19)
-extfunc @int_types(i1, i2, i4, i7, i87) -> (i1, index, i19)
+// CHECK: func @int_types(i1, i2, i4, i7, i87) -> (i1, index, i19)
+func @int_types(i1, i2, i4, i7, i87) -> (i1, index, i19)
-// CHECK: extfunc @vectors(vector<1xf32>, vector<2x4xf32>)
-extfunc @vectors(vector<1 x f32>, vector<2x4xf32>)
+// CHECK: func @vectors(vector<1xf32>, vector<2x4xf32>)
+func @vectors(vector<1 x f32>, vector<2x4xf32>)
-// CHECK: extfunc @tensors(tensor<*xf32>, tensor<*xvector<2x4xf32>>, tensor<1x?x4x?x?xi32>, tensor<i8>)
-extfunc @tensors(tensor<* x f32>, tensor<* x vector<2x4xf32>>,
+// CHECK: func @tensors(tensor<*xf32>, tensor<*xvector<2x4xf32>>, tensor<1x?x4x?x?xi32>, tensor<i8>)
+func @tensors(tensor<* x f32>, tensor<* x vector<2x4xf32>>,
tensor<1x?x4x?x?xi32>, tensor<i8>)
-// CHECK: extfunc @memrefs(memref<1x?x4x?x?xi32, #map{{[0-9]+}}>, memref<8xi8>)
-extfunc @memrefs(memref<1x?x4x?x?xi32, #map0>, memref<8xi8, #map1, #map1>)
+// CHECK: func @memrefs(memref<1x?x4x?x?xi32, #map{{[0-9]+}}>, memref<8xi8>)
+func @memrefs(memref<1x?x4x?x?xi32, #map0>, memref<8xi8, #map1, #map1>)
// Test memref affine map compositions.
-// CHECK: extfunc @memrefs2(memref<2x4x8xi8, 1>)
-extfunc @memrefs2(memref<2x4x8xi8, #map2, 1>)
+// CHECK: func @memrefs2(memref<2x4x8xi8, 1>)
+func @memrefs2(memref<2x4x8xi8, #map2, 1>)
-// CHECK: extfunc @memrefs23(memref<2x4x8xi8, #map{{[0-9]+}}>)
-extfunc @memrefs23(memref<2x4x8xi8, #map2, #map3, 0>)
+// CHECK: func @memrefs23(memref<2x4x8xi8, #map{{[0-9]+}}>)
+func @memrefs23(memref<2x4x8xi8, #map2, #map3, 0>)
-// CHECK: extfunc @memrefs234(memref<2x4x8xi8, #map{{[0-9]+}}, #map{{[0-9]+}}, 3>)
-extfunc @memrefs234(memref<2x4x8xi8, #map2, #map3, #map4, 3>)
+// CHECK: func @memrefs234(memref<2x4x8xi8, #map{{[0-9]+}}, #map{{[0-9]+}}, 3>)
+func @memrefs234(memref<2x4x8xi8, #map2, #map3, #map4, 3>)
// Test memref inline affine map compositions, minding that identity maps are removed.
-// CHECK: extfunc @memrefs3(memref<2x4x8xi8>)
-extfunc @memrefs3(memref<2x4x8xi8, (d0, d1, d2) -> (d0, d1, d2)>)
+// CHECK: func @memrefs3(memref<2x4x8xi8>)
+func @memrefs3(memref<2x4x8xi8, (d0, d1, d2) -> (d0, d1, d2)>)
-// CHECK: extfunc @memrefs33(memref<2x4x8xi8, #map{{[0-9]+}}, 1>)
-extfunc @memrefs33(memref<2x4x8xi8, (d0, d1, d2) -> (d0, d1, d2), (d0, d1, d2) -> (d1, d0, d2), 1>)
+// CHECK: func @memrefs33(memref<2x4x8xi8, #map{{[0-9]+}}, 1>)
+func @memrefs33(memref<2x4x8xi8, (d0, d1, d2) -> (d0, d1, d2), (d0, d1, d2) -> (d1, d0, d2), 1>)
-// CHECK: extfunc @memrefs_drop_triv_id_inline(memref<2xi8>)
-extfunc @memrefs_drop_triv_id_inline(memref<2xi8, (d0) -> (d0)>)
+// CHECK: func @memrefs_drop_triv_id_inline(memref<2xi8>)
+func @memrefs_drop_triv_id_inline(memref<2xi8, (d0) -> (d0)>)
-// CHECK: extfunc @memrefs_drop_triv_id_inline0(memref<2xi8>)
-extfunc @memrefs_drop_triv_id_inline0(memref<2xi8, (d0) -> (d0), 0>)
+// CHECK: func @memrefs_drop_triv_id_inline0(memref<2xi8>)
+func @memrefs_drop_triv_id_inline0(memref<2xi8, (d0) -> (d0), 0>)
-// CHECK: extfunc @memrefs_drop_triv_id_inline1(memref<2xi8, 1>)
-extfunc @memrefs_drop_triv_id_inline1(memref<2xi8, (d0) -> (d0), 1>)
+// CHECK: func @memrefs_drop_triv_id_inline1(memref<2xi8, 1>)
+func @memrefs_drop_triv_id_inline1(memref<2xi8, (d0) -> (d0), 1>)
// Identity maps should be dropped from the composition, but not the pair of
// "interchange" maps that, if composed, would be also an identity.
-// CHECK: extfunc @memrefs_drop_triv_id_composition(memref<2x2xi8, #map{{[0-9]+}}, #map{{[0-9]+}}>)
-extfunc @memrefs_drop_triv_id_composition(memref<2x2xi8,
+// CHECK: func @memrefs_drop_triv_id_composition(memref<2x2xi8, #map{{[0-9]+}}, #map{{[0-9]+}}>)
+func @memrefs_drop_triv_id_composition(memref<2x2xi8,
(d0, d1) -> (d1, d0),
(d0, d1) -> (d0, d1),
(d0, d1) -> (d1, d0),
(d0, d1) -> (d0, d1),
(d0, d1) -> (d0, d1)>)
-// CHECK: extfunc @memrefs_drop_triv_id_trailing(memref<2x2xi8, #map{{[0-9]+}}>)
-extfunc @memrefs_drop_triv_id_trailing(memref<2x2xi8, (d0, d1) -> (d1, d0),
+// CHECK: func @memrefs_drop_triv_id_trailing(memref<2x2xi8, #map{{[0-9]+}}>)
+func @memrefs_drop_triv_id_trailing(memref<2x2xi8, (d0, d1) -> (d1, d0),
(d0, d1) -> (d0, d1)>)
-// CHECK: extfunc @memrefs_drop_triv_id_middle(memref<2x2xi8, #map{{[0-9]+}}, #map{{[0-9]+}}>)
-extfunc @memrefs_drop_triv_id_middle(memref<2x2xi8, (d0, d1) -> (d0, d1 + 1),
+// CHECK: func @memrefs_drop_triv_id_middle(memref<2x2xi8, #map{{[0-9]+}}, #map{{[0-9]+}}>)
+func @memrefs_drop_triv_id_middle(memref<2x2xi8, (d0, d1) -> (d0, d1 + 1),
(d0, d1) -> (d0, d1),
(d0, d1) -> (d0 + 1, d1)>)
-// CHECK: extfunc @memrefs_drop_triv_id_multiple(memref<2xi8>)
-extfunc @memrefs_drop_triv_id_multiple(memref<2xi8, (d0) -> (d0), (d0) -> (d0)>)
+// CHECK: func @memrefs_drop_triv_id_multiple(memref<2xi8>)
+func @memrefs_drop_triv_id_multiple(memref<2xi8, (d0) -> (d0), (d0) -> (d0)>)
// These maps appeared before, so they must be uniqued and hoisted to the beginning.
// Identity map should be removed.
-// CHECK: extfunc @memrefs_compose_with_id(memref<2x2xi8, #map{{[0-9]+}}>)
-extfunc @memrefs_compose_with_id(memref<2x2xi8, (d0, d1) -> (d0, d1),
+// CHECK: func @memrefs_compose_with_id(memref<2x2xi8, #map{{[0-9]+}}>)
+func @memrefs_compose_with_id(memref<2x2xi8, (d0, d1) -> (d0, d1),
(d0, d1) -> (d1, d0)>)
-// CHECK: extfunc @functions((memref<1x?x4x?x?xi32, #map0>, memref<8xi8>) -> (), () -> ())
-extfunc @functions((memref<1x?x4x?x?xi32, #map0, 0>, memref<8xi8, #map1, 0>) -> (), ()->())
+// CHECK: func @functions((memref<1x?x4x?x?xi32, #map0>, memref<8xi8>) -> (), () -> ())
+func @functions((memref<1x?x4x?x?xi32, #map0, 0>, memref<8xi8, #map1, 0>) -> (), ()->())
-// CHECK-LABEL: cfgfunc @simpleCFG(%arg0: i32, %arg1: f32) -> i1 {
-cfgfunc @simpleCFG(%arg0: i32, %f: f32) -> i1 {
+// CHECK-LABEL: func @simpleCFG(%arg0: i32, %arg1: f32) -> i1 {
+func @simpleCFG(%arg0: i32, %f: f32) -> i1 {
// CHECK: %0 = "foo"() : () -> i64
%1 = "foo"() : ()->i64
// CHECK: "bar"(%0) : (i64) -> (i1, i1, i1)
// CHECK: }
}
-// CHECK-LABEL: cfgfunc @simpleCFGUsingBBArgs(%arg0: i32, %arg1: i64) {
-cfgfunc @simpleCFGUsingBBArgs(i32, i64) {
+// CHECK-LABEL: func @simpleCFGUsingBBArgs(%arg0: i32, %arg1: i64) {
+func @simpleCFGUsingBBArgs(i32, i64) {
^bb42 (%arg0: i32, %f: i64):
// CHECK: "bar"(%arg1) : (i64) -> (i1, i1, i1)
%2 = "bar"(%f) : (i64) -> (i1,i1,i1)
// CHECK: }
}
-// CHECK-LABEL: cfgfunc @multiblock() {
-cfgfunc @multiblock() {
+// CHECK-LABEL: func @multiblock() {
+func @multiblock() {
return // CHECK: return
^bb1: // CHECK: ^bb1: // no predecessors
br ^bb4 // CHECK: br ^bb3
return // CHECK: return
} // CHECK: }
-// CHECK-LABEL: mlfunc @emptyMLF() {
-mlfunc @emptyMLF() {
+// CHECK-LABEL: func @emptyMLF() {
+func @emptyMLF() {
return // CHECK: return
} // CHECK: }
-// CHECK-LABEL: mlfunc @mlfunc_with_one_arg(%arg0: i1) -> i2 {
-mlfunc @mlfunc_with_one_arg(%c : i1) -> i2 {
+// CHECK-LABEL: func @func_with_one_arg(%arg0: i1) -> i2 {
+func @func_with_one_arg(%c : i1) -> i2 {
// CHECK: %0 = "foo"(%arg0) : (i1) -> i2
%b = "foo"(%c) : (i1) -> (i2)
return %b : i2 // CHECK: return %0 : i2
} // CHECK: }
-// CHECK-LABEL: mlfunc @mlfunc_with_two_args(%arg0: f16, %arg1: i8) -> (i1, i32) {
-mlfunc @mlfunc_with_two_args(%a : f16, %b : i8) -> (i1, i32) {
+// CHECK-LABEL: func @func_with_two_args(%arg0: f16, %arg1: i8) -> (i1, i32) {
+func @func_with_two_args(%a : f16, %b : i8) -> (i1, i32) {
// CHECK: %0 = "foo"(%arg0, %arg1) : (f16, i8) -> (i1, i32)
%c = "foo"(%a, %b) : (f16, i8)->(i1, i32)
return %c#0, %c#1 : i1, i32 // CHECK: return %0#0, %0#1 : i1, i32
} // CHECK: }
-// CHECK-LABEL: cfgfunc @cfgfunc_with_two_args(%arg0: f16, %arg1: i8) -> (i1, i32) {
-cfgfunc @cfgfunc_with_two_args(%a : f16, %b : i8) -> (i1, i32) {
- // CHECK: %0 = "foo"(%arg0, %arg1) : (f16, i8) -> (i1, i32)
- %c = "foo"(%a, %b) : (f16, i8)->(i1, i32)
- return %c#0, %c#1 : i1, i32 // CHECK: return %0#0, %0#1 : i1, i32
-} // CHECK: }
-
-// CHECK-LABEL: mlfunc @mlfunc_ops_in_loop() {
-mlfunc @mlfunc_ops_in_loop() {
+// CHECK-LABEL: func @func_ops_in_loop() {
+func @func_ops_in_loop() {
// CHECK: %0 = "foo"() : () -> i64
%a = "foo"() : ()->i64
// CHECK: for %i0 = 1 to 10 {
}
-// CHECK-LABEL: mlfunc @loops() {
-mlfunc @loops() {
+// CHECK-LABEL: func @loops() {
+func @loops() {
// CHECK: for %i0 = 1 to 100 step 2 {
for %i = 1 to 100 step 2 {
// CHECK: for %i1 = 1 to 200 {
return // CHECK: return
} // CHECK: }
-// CHECK-LABEL: mlfunc @complex_loops() {
-mlfunc @complex_loops() {
+// CHECK-LABEL: func @complex_loops() {
+func @complex_loops() {
for %i1 = 1 to 100 { // CHECK: for %i0 = 1 to 100 {
for %j1 = 1 to 100 { // CHECK: for %i1 = 1 to 100 {
// CHECK: "foo"(%i0, %i1) : (index, index) -> ()
return // CHECK: return
} // CHECK: }
-// CHECK: mlfunc @triang_loop(%arg0: index, %arg1: memref<?x?xi32>) {
-mlfunc @triang_loop(%arg0: index, %arg1: memref<?x?xi32>) {
+// CHECK: func @triang_loop(%arg0: index, %arg1: memref<?x?xi32>) {
+func @triang_loop(%arg0: index, %arg1: memref<?x?xi32>) {
%c = constant 0 : i32 // CHECK: %c0_i32 = constant 0 : i32
for %i0 = 1 to %arg0 { // CHECK: for %i0 = 1 to %arg0 {
for %i1 = %i0 to %arg0 { // CHECK: for %i1 = #map{{[0-9]+}}(%i0) to %arg0 {
return // CHECK: return
} // CHECK: }
-// CHECK: mlfunc @minmax_loop(%arg0: index, %arg1: index, %arg2: memref<100xf32>) {
-mlfunc @minmax_loop(%arg0: index, %arg1: index, %arg2: memref<100xf32>) {
+// CHECK: func @minmax_loop(%arg0: index, %arg1: index, %arg2: memref<100xf32>) {
+func @minmax_loop(%arg0: index, %arg1: index, %arg2: memref<100xf32>) {
// CHECK: for %i0 = max #map{{.*}}()[%arg0] to min #map{{.*}}()[%arg1] {
for %i0 = max()[s]->(0,s-1)()[%arg0] to min()[s]->(100,s+1)()[%arg1] {
// CHECK: "foo"(%arg2, %i0) : (memref<100xf32>, index) -> ()
return // CHECK: return
} // CHECK: }
-// CHECK-LABEL: mlfunc @loop_bounds(%arg0: index) {
-mlfunc @loop_bounds(%N : index) {
+// CHECK-LABEL: func @loop_bounds(%arg0: index) {
+func @loop_bounds(%N : index) {
// CHECK: %0 = "foo"(%arg0) : (index) -> index
%s = "foo"(%N) : (index) -> index
// CHECK: for %i0 = %0 to %arg0
return // CHECK: return
} // CHECK: }
-// CHECK-LABEL: mlfunc @ifinst(%arg0: index) {
-mlfunc @ifinst(%N: index) {
+// CHECK-LABEL: func @ifinst(%arg0: index) {
+func @ifinst(%N: index) {
%c = constant 200 : index // CHECK %c200 = constant 200
for %i = 1 to 10 { // CHECK for %i0 = 1 to 10 {
if #set0(%i)[%N, %c] { // CHECK if #set0(%i0)[%arg0, %c200] {
return // CHECK return
} // CHECK }
-// CHECK-LABEL: mlfunc @simple_ifinst(%arg0: index) {
-mlfunc @simple_ifinst(%N: index) {
+// CHECK-LABEL: func @simple_ifinst(%arg0: index) {
+func @simple_ifinst(%N: index) {
%c = constant 200 : index // CHECK %c200 = constant 200
for %i = 1 to 10 { // CHECK for %i0 = 1 to 10 {
if #set0(%i)[%N, %c] { // CHECK if #set0(%i0)[%arg0, %c200] {
return // CHECK return
} // CHECK }
-// CHECK-LABEL: cfgfunc @attributes() {
-cfgfunc @attributes() {
+// CHECK-LABEL: func @attributes() {
+func @attributes() {
// CHECK: "foo"()
"foo"(){} : ()->()
// CHECK: "foo"() {set12: [#set{{[0-9]+}}, #set{{[0-9]+}}]}
"foo"() {set12: [#set1, #set2]} : () -> ()
- // CHECK: "foo"() {cfgfunc: [], d: 1.000000e-09, i123: 7, if: "foo"} : () -> ()
- "foo"() {if: "foo", cfgfunc: [], i123: 7, d: 1.e-9} : () -> ()
+ // CHECK: "foo"() {d: 1.000000e-09, func: [], i123: 7, if: "foo"} : () -> ()
+ "foo"() {if: "foo", func: [], i123: 7, d: 1.e-9} : () -> ()
// CHECK: "foo"() {fn: @attributes : () -> (), if: @ifinst : (index) -> ()} : () -> ()
"foo"() {fn: @attributes : () -> (), if: @ifinst : (index) -> ()} : () -> ()
return
}
-// CHECK-LABEL: cfgfunc @ssa_values() -> (i16, i8) {
-cfgfunc @ssa_values() -> (i16, i8) {
+// CHECK-LABEL: func @ssa_values() -> (i16, i8) {
+func @ssa_values() -> (i16, i8) {
// CHECK: %0 = "foo"() : () -> (i1, i17)
%0 = "foo"() : () -> (i1, i17)
br ^bb2
br ^bb1
}
-// CHECK-LABEL: cfgfunc @bbargs() -> (i16, i8) {
-cfgfunc @bbargs() -> (i16, i8) {
+// CHECK-LABEL: func @bbargs() -> (i16, i8) {
+func @bbargs() -> (i16, i8) {
// CHECK: %0 = "foo"() : () -> (i1, i17)
%0 = "foo"() : () -> (i1, i17)
br ^bb1(%0#1, %0#0 : i17, i1)
return %1#0, %1#1 : i16, i8
}
-// CHECK-LABEL: cfgfunc @condbr_simple
-cfgfunc @condbr_simple() -> (i32) {
+// CHECK-LABEL: func @condbr_simple
+func @condbr_simple() -> (i32) {
%cond = "foo"() : () -> i1
%a = "bar"() : () -> i32
%b = "bar"() : () -> i64
return %z : i32
}
-// CHECK-LABEL: cfgfunc @condbr_moarargs
-cfgfunc @condbr_moarargs() -> (i32) {
+// CHECK-LABEL: func @condbr_moarargs
+func @condbr_moarargs() -> (i32) {
%cond = "foo"() : () -> i1
%a = "bar"() : () -> i32
%b = "bar"() : () -> i64
// Test pretty printing of constant names.
-// CHECK-LABEL: cfgfunc @constants
-cfgfunc @constants() -> (i32, i23, i23, i1, i1) {
+// CHECK-LABEL: func @constants
+func @constants() -> (i32, i23, i23, i1, i1) {
// CHECK: %c42_i32 = constant 42 : i32
%x = constant 42 : i32
// CHECK: %c17_i23 = constant 17 : i23
return %x, %y, %z, %t, %f : i32, i23, i23, i1, i1
}
-// CHECK-LABEL: cfgfunc @typeattr
-cfgfunc @typeattr() -> () {
+// CHECK-LABEL: func @typeattr
+func @typeattr() -> () {
^bb0:
// CHECK: "foo"() {bar: tensor<*xf32>} : () -> ()
"foo"(){bar: tensor<*xf32>} : () -> ()
return
}
-// CHECK-LABEL: cfgfunc @stringquote
-cfgfunc @stringquote() -> () {
+// CHECK-LABEL: func @stringquote
+func @stringquote() -> () {
^bb0:
// CHECK: "foo"() {bar: "a\22quoted\22string"} : () -> ()
"foo"(){bar: "a\"quoted\"string"} : () -> ()
return
}
-// CHECK-LABEL: cfgfunc @floatAttrs
-cfgfunc @floatAttrs() -> () {
+// CHECK-LABEL: func @floatAttrs
+func @floatAttrs() -> () {
^bb0:
// CHECK: "foo"() {a: 4.000000e+00, b: 2.000000e+00, c: 7.100000e+00, d: -0.000000e+00} : () -> ()
"foo"(){a: 4.0, b: 2.0, c: 7.1, d: -0.0} : () -> ()
return
}
-// CHECK-LABEL: extfunc @extfuncattr
-extfunc @extfuncattr() -> ()
+// CHECK-LABEL: func @externalfuncattr
+func @externalfuncattr() -> ()
// CHECK: attributes {a: "a\22quoted\22string", b: 4.000000e+00, c: tensor<*xf32>}
attributes {a: "a\"quoted\"string", b: 4.0, c: tensor<*xf32>}
-// CHECK-LABEL: extfunc @extfuncattrempty
-extfunc @extfuncattrempty() -> ()
+// CHECK-LABEL: func @funcattrempty
+func @funcattrempty() -> ()
// CHECK-EMPTY
attributes {}
-// CHECK-LABEL: cfgfunc @cfgfuncattr
-cfgfunc @cfgfuncattr() -> ()
+// CHECK-LABEL: func @funcattr
+func @funcattr() -> ()
// CHECK: attributes {a: "a\22quoted\22string", b: 4.000000e+00, c: tensor<*xf32>}
attributes {a: "a\"quoted\"string", b: 4.0, c: tensor<*xf32>} {
^bb0:
return
}
-// CHECK-LABEL: cfgfunc @cfgfuncattrempty
-cfgfunc @cfgfuncattrempty() -> ()
+// CHECK-LABEL: func @funcattrwithblock
+func @funcattrwithblock() -> ()
// CHECK-EMPTY
attributes {} {
^bb0:
return
}
-// CHECK-LABEL: mlfunc @mlfuncattr
-mlfunc @mlfuncattr() -> ()
- // CHECK: attributes {a: "a\22quoted\22string", b: 4.000000e+00, c: tensor<*xf32>}
- attributes {a: "a\"quoted\"string", b: 4.0, c: tensor<*xf32>} {
- return
-}
-
-// CHECK-LABEL: mlfunc @mlfuncattrempty
-mlfunc @mlfuncattrempty() -> ()
- // CHECK-EMPTY
- attributes {} {
- return
-}
-
-// CHECK-label mlfunc @mlfuncsimplemap
+// CHECK-label func @funcsimplemap
#map_simple0 = ()[] -> (10)
#map_simple1 = ()[s0] -> (s0)
#map_non_simple0 = (d0)[] -> (d0)
#map_non_simple1 = (d0)[s0] -> (d0 + s0)
#map_non_simple2 = ()[s0, s1] -> (s0 + s1)
#map_non_simple3 = ()[s0] -> (s0 + 3)
-mlfunc @mlfuncsimplemap(%arg0: index, %arg1: index) -> () {
+func @funcsimplemap(%arg0: index, %arg1: index) -> () {
for %i0 = 0 to #map_simple0()[] {
// CHECK: for %i0 = 0 to 10 {
for %i1 = 0 to #map_simple1()[%arg1] {
return
}
-// CHECK-LABEL: cfgfunc @splattensorattr
-cfgfunc @splattensorattr() -> () {
+// CHECK-LABEL: func @splattensorattr
+func @splattensorattr() -> () {
^bb0:
// CHECK: "splatIntTensor"() {bar: splat<tensor<2x1x4xi32>, 5>} : () -> ()
"splatIntTensor"(){bar: splat<tensor<2x1x4xi32>, 5>} : () -> ()
return
}
-// CHECK-LABEL: cfgfunc @opaquetensorattr
-cfgfunc @opaquetensorattr() -> () {
+// CHECK-LABEL: func @opaquetensorattr
+func @opaquetensorattr() -> () {
^bb0:
// CHECK: "opaqueIntTensor"() {bar: opaque<tensor<2x1x4xi32>, "0x68656C6C6F">} : () -> ()
"opaqueIntTensor"(){bar: opaque<tensor<2x1x4xi32>, "0x68656C6C6F">} : () -> ()
return
}
-// CHECK-LABEL: cfgfunc @densetensorattr
-cfgfunc @densetensorattr() -> () {
+// CHECK-LABEL: func @densetensorattr
+func @densetensorattr() -> () {
^bb0:
// NOTE: The {{\[\[}} syntax is because "[[" confuses FileCheck.
return
}
-// CHECK-LABEL: cfgfunc @densevectorattr
-cfgfunc @densevectorattr() -> () {
+// CHECK-LABEL: func @densevectorattr
+func @densevectorattr() -> () {
^bb0:
// NOTE: The {{\[\[}} syntax is because "[[" confuses FileCheck.
// CHECK: "fooi8"() {bar: dense<vector<1x1x1xi8>, {{\[\[\[}}5]]]>} : () -> ()
return
}
-// CHECK-LABEL: cfgfunc @sparsetensorattr
-cfgfunc @sparsetensorattr() -> () {
+// CHECK-LABEL: func @sparsetensorattr
+func @sparsetensorattr() -> () {
^bb0:
// NOTE: The {{\[\[}} syntax is because "[[" confuses FileCheck.
// CHECK: "fooi8"() {bar: sparse<tensor<1x1x1xi8>, {{\[\[}}0, 0, 0]], {{\[}}-2]>} : () -> ()
return
}
-// CHECK-LABEL: cfgfunc @sparsevectorattr
-cfgfunc @sparsevectorattr() -> () {
+// CHECK-LABEL: func @sparsevectorattr
+func @sparsevectorattr() -> () {
^bb0:
// NOTE: The {{\[\[}} syntax is because "[[" confuses FileCheck.
// CHECK: "fooi8"() {bar: sparse<vector<1x1x1xi8>, {{\[\[}}0, 0, 0]], {{\[}}-2]>} : () -> ()
return
}
-// CHECK-LABEL: mlfunc @loops_with_blockids() {
-mlfunc @loops_with_blockids() {
+// CHECK-LABEL: func @loops_with_blockids() {
+func @loops_with_blockids() {
^block0:
for %i = 1 to 100 step 2 {
^block1:
// RUN: mlir-opt %s | FileCheck %s
-cfgfunc @testType(tensor<1x224x224x3xf32>) -> tensor<96xf32> {
+func @testType(tensor<1x224x224x3xf32>) -> tensor<96xf32> {
^bb0(%arg0: tensor<1x224x224x3xf32>):
%1 = "constant"() {value: splat<tensor<1xf32>, 0.1>} : () -> (tensor<1xf32>)
%2 = "constant"() {value: splat<tensor<2xf32>, 0.1>} : () -> (tensor<2xf32>)
// CHECK-LABEL: define void @empty() {
// CHECK-NEXT: ret void
// CHECK-NEXT: }
-cfgfunc @empty() {
+func @empty() {
^bb0:
return
}
// CHECK-LABEL: declare void @body(i64)
-extfunc @body(index)
+func @body(index)
// CHECK-LABEL: define void @simple_loop() {
-cfgfunc @simple_loop() {
+func @simple_loop() {
^bb0:
// CHECK: br label %[[SIMPLE_bb1:[0-9]+]]
br ^bb1
// CHECK-NEXT: call void @simple_loop()
// CHECK-NEXT: ret void
// CHECK-NEXT: }
-cfgfunc @simple_caller() {
+func @simple_caller() {
^bb0:
call @simple_loop() : () -> ()
return
}
-//cfgfunc @simple_indirect_caller() {
+//func @simple_indirect_caller() {
//^bb0:
// %f = constant @simple_loop : () -> ()
// call_indirect %f() : () -> ()
// CHECK-NEXT: call void @more_imperfectly_nested_loops()
// CHECK-NEXT: ret void
// CHECK-NEXT: }
-cfgfunc @ml_caller() {
+func @ml_caller() {
^bb0:
call @simple_loop() : () -> ()
call @more_imperfectly_nested_loops() : () -> ()
}
// CHECK-LABEL: declare i64 @body_args(i64)
-extfunc @body_args(index) -> index
+func @body_args(index) -> index
// CHECK-LABEL: declare i32 @other(i64, i32)
-extfunc @other(index, i32) -> i32
+func @other(index, i32) -> i32
-// CHECK-LABEL: define i32 @mlfunc_args(i32, i32) {
+// CHECK-LABEL: define i32 @func_args(i32, i32) {
// CHECK-NEXT: br label %[[ARGS_bb1:[0-9]+]]
-cfgfunc @mlfunc_args(i32, i32) -> i32 {
+func @func_args(i32, i32) -> i32 {
^bb0(%arg0: i32, %arg1: i32):
%c0_i32 = constant 0 : i32
br ^bb1
}
// CHECK: declare void @pre(i64)
-extfunc @pre(index)
+func @pre(index)
// CHECK: declare void @body2(i64, i64)
-extfunc @body2(index, index)
+func @body2(index, index)
// CHECK: declare void @post(i64)
-extfunc @post(index)
+func @post(index)
// CHECK-LABEL: define void @imperfectly_nested_loops() {
// CHECK-NEXT: br label %[[IMPER_bb1:[0-9]+]]
-cfgfunc @imperfectly_nested_loops() {
+func @imperfectly_nested_loops() {
^bb0:
br ^bb1
}
// CHECK: declare void @mid(i64)
-extfunc @mid(index)
+func @mid(index)
// CHECK: declare void @body3(i64, i64)
-extfunc @body3(index, index)
+func @body3(index, index)
// A complete function transformation check.
// CHECK-LABEL: define void @more_imperfectly_nested_loops() {
// CHECK: ; <label>:21: ; preds = %2
// CHECK-NEXT: ret void
// CHECK-NEXT: }
-cfgfunc @more_imperfectly_nested_loops() {
+func @more_imperfectly_nested_loops() {
^bb0:
br ^bb1
^bb1: // pred: ^bb0
//
// CHECK-LABEL: define void @memref_alloc()
-cfgfunc @memref_alloc() {
+func @memref_alloc() {
^bb0:
// CHECK-NEXT: %{{[0-9]+}} = call i8* @__mlir_alloc(i64 400)
// CHECK-NEXT: %{{[0-9]+}} = bitcast i8* %{{[0-9]+}} to float*
}
// CHECK-LABEL: declare i64 @get_index()
-extfunc @get_index() -> index
+func @get_index() -> index
// CHECK-LABEL: define void @store_load_static()
-cfgfunc @store_load_static() {
+func @store_load_static() {
^bb0:
// CHECK-NEXT: %{{[0-9]+}} = call i8* @__mlir_alloc(i64 40)
// CHECK-NEXT: %{{[0-9]+}} = bitcast i8* %{{[0-9]+}} to float*
}
// CHECK-LABEL: define void @store_load_dynamic(i64)
-cfgfunc @store_load_dynamic(index) {
+func @store_load_dynamic(index) {
^bb0(%arg0: index):
// CHECK-NEXT: %{{[0-9]+}} = mul i64 %{{[0-9]+}}, 4
// CHECK-NEXT: %{{[0-9]+}} = call i8* @__mlir_alloc(i64 %{{[0-9]+}})
}
// CHECK-LABEL: define void @store_load_mixed(i64)
-cfgfunc @store_load_mixed(index) {
+func @store_load_mixed(index) {
^bb0(%arg0: index):
%c10 = constant 10 : index
// CHECK-NEXT: %{{[0-9]+}} = mul i64 2, %{{[0-9]+}}
}
// CHECK-LABEL: define { float*, i64 } @memref_args_rets({ float* }, { float*, i64 }, { float*, i64 }) {
-cfgfunc @memref_args_rets(memref<10xf32>, memref<?xf32>, memref<10x?xf32>) -> memref<10x?xf32> {
+func @memref_args_rets(memref<10xf32>, memref<?xf32>, memref<10x?xf32>) -> memref<10x?xf32> {
^bb0(%arg0: memref<10xf32>, %arg1: memref<?xf32>, %arg2: memref<10x?xf32>):
%c7 = constant 7 : index
// CHECK-NEXT: %{{[0-9]+}} = call i64 @get_index()
// CHECK-LABEL: define i64 @memref_dim({ float*, i64, i64 })
-cfgfunc @memref_dim(memref<42x?x10x?xf32>) -> index {
+func @memref_dim(memref<42x?x10x?xf32>) -> index {
^bb0(%arg0: memref<42x?x10x?xf32>):
// Expecting this to create an LLVM constant.
%d0 = dim %arg0, 0 : memref<42x?x10x?xf32>
return %d0123 : index
}
-extfunc @get_i64() -> (i64)
-extfunc @get_f32() -> (f32)
-extfunc @get_memref() -> (memref<42x?x10x?xf32>)
+func @get_i64() -> (i64)
+func @get_f32() -> (f32)
+func @get_memref() -> (memref<42x?x10x?xf32>)
// CHECK-LABEL: define { i64, float, { float*, i64, i64 } } @multireturn() {
-cfgfunc @multireturn() -> (i64, f32, memref<42x?x10x?xf32>) {
+func @multireturn() -> (i64, f32, memref<42x?x10x?xf32>) {
^bb0:
%0 = call @get_i64() : () -> (i64)
%1 = call @get_f32() : () -> (f32)
// CHECK-LABEL: define void @multireturn_caller() {
-cfgfunc @multireturn_caller() {
+func @multireturn_caller() {
^bb0:
// CHECK-NEXT: %1 = call { i64, float, { float*, i64, i64 } } @multireturn()
// CHECK-NEXT: [[ret0:%[0-9]+]] = extractvalue { i64, float, { float*, i64, i64 } } %1, 0
// CHECK-NEXT: %2 = fadd <4 x float> %0, <float 4.200000e+01, float 4.200000e+01, float 4.200000e+01, float 4.200000e+01>
// CHECK-NEXT: ret <4 x float> %2
// CHECK-NEXT: }
-cfgfunc @vector_ops(vector<4xf32>) -> vector<4xf32> {
+func @vector_ops(vector<4xf32>) -> vector<4xf32> {
^bb0(%arg0: vector<4xf32>):
%0 = constant splat<vector<4xf32>, 42.> : vector<4xf32>
%1 = addf %arg0, %0 : vector<4xf32>
}
// CHECK-LABEL: @ops
-cfgfunc @ops(f32, f32, i32, i32) -> (f32, i32) {
+func @ops(f32, f32, i32, i32) -> (f32, i32) {
^bb0(%arg0: f32, %arg1: f32, %arg2: i32, %arg3: i32):
// CHECK-NEXT: fsub float %0, %1
%0 = subf %arg0, %arg1: f32
// will produce the sequence of compositions: f, g(f), h(g(f)) and print the
// AffineMap h(g(f)), which is what FileCheck checks against.
-mlfunc @simple1() {
+func @simple1() {
// CHECK: Composed map: (d0) -> (d0)
"test_affine_map"() { affine_map: (d0) -> (d0 - 1) } : () -> ()
"test_affine_map"() { affine_map: (d0) -> (d0 + 1) } : () -> ()
return
}
-mlfunc @simple2() {
+func @simple2() {
// CHECK: Composed map: (d0)[s0] -> (d0)
"test_affine_map"() { affine_map: (d0)[s0] -> (d0 + s0 - 1) } : () -> ()
"test_affine_map"() { affine_map: (d0)[s0] -> (d0 - s0 + 1) } : () -> ()
return
}
-mlfunc @simple3a() {
+func @simple3a() {
// CHECK: Composed map: (d0, d1)[s0, s1] -> ((d0 ceildiv s0) * s0, (d1 ceildiv s1) * s1)
"test_affine_map"() { affine_map: (d0, d1)[s0, s1] -> (d0 ceildiv s0, d1 ceildiv s1) } : () -> ()
"test_affine_map"() { affine_map: (d0, d1)[s0, s1] -> (d0 * s0, d1 * s1) } : () -> ()
return
}
-mlfunc @simple3b() {
+func @simple3b() {
// CHECK: Composed map: (d0, d1)[s0, s1] -> (d0 mod s0, d1 mod s1)
"test_affine_map"() { affine_map: (d0, d1)[s0, s1] -> (d0 mod s0, d1 mod s1) } : () -> ()
return
}
-mlfunc @simple3c() {
+func @simple3c() {
// CHECK: Composed map: (d0, d1)[s0, s1, s2, s3] -> ((d0 ceildiv s0) * s0 + d0 mod s2, (d1 ceildiv s1) * s1 + d1 mod s3)
"test_affine_map"() { affine_map: (d0, d1)[s0, s1] -> ((d0 ceildiv s0) * s0, (d1 ceildiv s1) * s1, d0, d1) } : () -> ()
"test_affine_map"() { affine_map: (d0, d1, d2, d3)[s0, s1, s2, s3] -> (d0 + d2 mod s2, d1 + d3 mod s3) } : () -> ()
return
}
-mlfunc @simple4() {
+func @simple4() {
// CHECK: Composed map: (d0, d1)[s0, s1] -> (d1 * s1, d0 ceildiv s0)
"test_affine_map"() { affine_map: (d0, d1) -> (d1, d0) } : () -> ()
"test_affine_map"() { affine_map: (d0, d1)[s0, s1] -> (d0 * s1, d1 ceildiv s0) } : () -> ()
return
}
-mlfunc @simple5a() {
+func @simple5a() {
// CHECK: Composed map: (d0) -> (d0 * 3 + 18)
"test_affine_map"() { affine_map: (d0) -> (d0 - 1) } : () -> ()
"test_affine_map"() { affine_map: (d0) -> (d0 + 7) } : () -> ()
return
}
-mlfunc @simple5b() {
+func @simple5b() {
// CHECK: Composed map: (d0) -> ((d0 + 6) ceildiv 2)
"test_affine_map"() { affine_map: (d0) -> (d0 - 1) } : () -> ()
"test_affine_map"() { affine_map: (d0) -> (d0 + 7) } : () -> ()
return
}
-mlfunc @simple5c() {
+func @simple5c() {
// CHECK: Composed map: (d0) -> (d0 * 8 + 48)
"test_affine_map"() { affine_map: (d0) -> (d0 - 1) } : () -> ()
"test_affine_map"() { affine_map: (d0) -> (d0 + 7) } : () -> ()
return
}
-mlfunc @simple5d() {
+func @simple5d() {
// CHECK: Composed map: (d0) -> ((d0 * 4 + 24) floordiv 3)
"test_affine_map"() { affine_map: (d0) -> (d0 - 1) } : () -> ()
"test_affine_map"() { affine_map: (d0) -> (d0 + 7) } : () -> ()
return
}
-mlfunc @simple5e() {
+func @simple5e() {
// CHECK: Composed map: (d0) -> ((d0 + 6) ceildiv 8)
"test_affine_map"() { affine_map: (d0) -> (d0 - 1) } : () -> ()
"test_affine_map"() { affine_map: (d0) -> (d0 + 7) } : () -> ()
return
}
-mlfunc @simple5f() {
+func @simple5f() {
// CHECK: Composed map: (d0) -> ((d0 * 4 - 4) floordiv 3)
"test_affine_map"() { affine_map: (d0) -> (d0 - 1) } : () -> ()
"test_affine_map"() { affine_map: (d0) -> (d0 * 4) } : () -> ()
return
}
-mlfunc @perm_and_proj() {
+func @perm_and_proj() {
// CHECK: Composed map: (d0, d1, d2, d3) -> (d1, d3, d0)
"test_affine_map"() { affine_map: (d0, d1, d2, d3) -> (d3, d1, d2, d0) } : () -> ()
"test_affine_map"() { affine_map: (d0, d1, d2, d3) -> (d1, d0, d3) } : () -> ()
return
}
-mlfunc @symbols1() {
+func @symbols1() {
// CHECK: Composed map: (d0)[s0] -> (d0 + s0 + 1, d0 - s0 - 1)
"test_affine_map"() { affine_map: (d0)[s0] -> (d0 + s0, d0 - s0) } : () -> ()
"test_affine_map"() { affine_map: (d0, d1) -> (d0 + 1, d1 - 1) } : () -> ()
// CHECK: #[[ADD:map[0-9]+]] = (d0, d1) -> (d0 + d1)
// CHECK: #[[SUB:map[0-9]+]] = (d0, d1) -> (d0 - d1)
-// CHECK-LABEL: mlfunc @materialize_read(%arg0: index, %arg1: index, %arg2: index, %arg3: index) {
-mlfunc @materialize_read(%M: index, %N: index, %O: index, %P: index) {
+// CHECK-LABEL: func @materialize_read(%arg0: index, %arg1: index, %arg2: index, %arg3: index) {
+func @materialize_read(%M: index, %N: index, %O: index, %P: index) {
// CHECK-NEXT: %0 = alloc(%arg0, %arg1, %arg2, %arg3) : memref<?x?x?x?xf32>
// CHECK-NEXT: for %i0 = 0 to %arg0 step 3 {
// CHECK-NEXT: for %i1 = 0 to %arg1 {
return
}
-// CHECK-LABEL:mlfunc @materialize_write(%arg0: index, %arg1: index, %arg2: index, %arg3: index) {
-mlfunc @materialize_write(%M: index, %N: index, %O: index, %P: index) {
+// CHECK-LABEL:func @materialize_write(%arg0: index, %arg1: index, %arg2: index, %arg3: index) {
+func @materialize_write(%M: index, %N: index, %O: index, %P: index) {
// CHECK-NEXT: %0 = alloc(%arg0, %arg1, %arg2, %arg3) : memref<?x?x?x?xf32>
// CHECK-NEXT: %cst = constant splat<vector<5x4x3xf32>, 1.000000e+00> : vector<5x4x3xf32>
// CHECK-NEXT: for %i0 = 0 to %arg0 step 3 {
// CHECK-DAG: #[[map_instance_3:map[0-9]+]] = (d0, d1, d2, d3) -> (d0, d1 + 3, d2, d3)
// CHECK-DAG: #[[map_proj_d0d1d2d3d4_d1d0:map[0-9]+]] = (d0, d1, d2, d3) -> (d1, d0)
-mlfunc @materialize(%M : index, %N : index, %O : index, %P : index) {
+func @materialize(%M : index, %N : index, %O : index, %P : index) {
%A = alloc (%M, %N, %O, %P) : memref<?x?x?x?xf32, 0>
%f1 = constant splat<vector<4x4x4xf32>, 1.000000e+00> : vector<4x4x4xf32>
// CHECK: for %i0 = 0 to %arg0 step 4 {
// CHECK-DAG: [[MAP1:#.*]] = (d0, d1) -> (d0, d1 + 8)
// CHECK-DAG: [[MAP2:#.*]] = (d0, d1) -> (d0, d1 + 16)
// CHECK-DAG: [[MAP3:#.*]] = (d0, d1) -> (d0, d1 + 24)
-mlfunc @vector_add_2d(%M : index, %N : index) -> f32 {
+func @vector_add_2d(%M : index, %N : index) -> f32 {
%A = alloc (%M, %N) : memref<?x?xf32, 0>
%B = alloc (%M, %N) : memref<?x?xf32, 0>
%C = alloc (%M, %N) : memref<?x?xf32, 0>
// CHECK-DAG: [[MAP3:#.*]] = (d0, d1) -> (d0 + 1, d1 + 8)
// CHECK-DAG: [[MAP4:#.*]] = (d0, d1) -> (d0 + 2, d1)
// CHECK-DAG: [[MAP5:#.*]] = (d0, d1) -> (d0 + 2, d1 + 8)
-mlfunc @vector_add_2d(%M : index, %N : index) -> f32 {
+func @vector_add_2d(%M : index, %N : index) -> f32 {
%A = alloc (%M, %N) : memref<?x?xf32, 0>
%B = alloc (%M, %N) : memref<?x?xf32, 0>
%C = alloc (%M, %N) : memref<?x?xf32, 0>
// vector<3x32xf32> -> vector<3x16xf32>
// CHECK-DAG: [[MAP1:#.*]] = (d0, d1) -> (d0, d1 + 16)
-mlfunc @vector_add_2d(%M : index, %N : index) -> f32 {
+func @vector_add_2d(%M : index, %N : index) -> f32 {
%A = alloc (%M, %N) : memref<?x?xf32, 0>
%B = alloc (%M, %N) : memref<?x?xf32, 0>
%C = alloc (%M, %N) : memref<?x?xf32, 0>
// RUN: mlir-opt %s -vectorizer-test -vector-shape-ratio 4 -vector-shape-ratio 8 | FileCheck %s
// RUN: mlir-opt %s -vectorizer-test -vector-shape-ratio 2 -vector-shape-ratio 5 -vector-shape-ratio 2 | FileCheck %s -check-prefix=TEST-3x4x5x8
-mlfunc @vector_add_2d(%arg0: index, %arg1: index) -> f32 {
+func @vector_add_2d(%arg0: index, %arg1: index) -> f32 {
// Nothing should be matched in this first block.
// CHECK-NOT:matched: {{.*}} = alloc{{.*}}
// CHECK-NOT:matched: {{.*}} = constant 0{{.*}}
#set0 = (i) : (i >= 0)
// Maps introduced to vectorize fastest varying memory index.
-mlfunc @vec1d(%A : memref<?x?xf32>, %B : memref<?x?x?xf32>) {
+func @vec1d(%A : memref<?x?xf32>, %B : memref<?x?x?xf32>) {
// CHECK-DAG: [[C0:%[a-z0-9_]+]] = constant 0 : index
// CHECK-DAG: [[ARG_M:%[0-9]+]] = dim %arg0, 0 : memref<?x?xf32>
// CHECK-DAG: [[ARG_N:%[0-9]+]] = dim %arg0, 1 : memref<?x?xf32>
return
}
-mlfunc @vector_add_2d(%M : index, %N : index) -> f32 {
+func @vector_add_2d(%M : index, %N : index) -> f32 {
%A = alloc (%M, %N) : memref<?x?xf32, 0>
%B = alloc (%M, %N) : memref<?x?xf32, 0>
%C = alloc (%M, %N) : memref<?x?xf32, 0>
// This should not vectorize and should not crash.
// CHECK-LABEL: @vec_rejected
-mlfunc @vec_rejected(%A : memref<?x?xf32>, %C : memref<?x?xf32>) {
+func @vec_rejected(%A : memref<?x?xf32>, %C : memref<?x?xf32>) {
%N = dim %A, 0 : memref<?x?xf32>
for %i = 0 to %N {
// CHECK-NOT: vector
// Permutation maps used in vectorization.
// CHECK: #[[map_proj_d0d1_d0d1:map[0-9]+]] = (d0, d1) -> (d0, d1)
-mlfunc @vec2d(%A : memref<?x?x?xf32>) {
+func @vec2d(%A : memref<?x?x?xf32>) {
%M = dim %A, 0 : memref<?x?x?xf32>
%N = dim %A, 1 : memref<?x?x?xf32>
%P = dim %A, 2 : memref<?x?x?xf32>
return
}
-mlfunc @vector_add_2d(%M : index, %N : index) -> f32 {
+func @vector_add_2d(%M : index, %N : index) -> f32 {
%A = alloc (%M, %N) : memref<?x?xf32, 0>
%B = alloc (%M, %N) : memref<?x?xf32, 0>
%C = alloc (%M, %N) : memref<?x?xf32, 0>
// Permutation maps used in vectorization.
// CHECK: #[[map_proj_d0d1d2_d0d1d2:map[0-9]+]] = (d0, d1, d2) -> (d0, d1, d2)
-mlfunc @vec3d(%A : memref<?x?x?xf32>) {
+func @vec3d(%A : memref<?x?x?xf32>) {
%0 = dim %A, 0 : memref<?x?x?xf32>
%1 = dim %A, 1 : memref<?x?x?xf32>
%2 = dim %A, 2 : memref<?x?x?xf32>
// Permutation maps used in vectorization.
// CHECK: #[[map_proj_d0d1d2_d0d2:map[0-9]+]] = (d0, d1, d2) -> (d0, d2)
-mlfunc @vec2d(%A : memref<?x?x?xf32>) {
+func @vec2d(%A : memref<?x?x?xf32>) {
%M = dim %A, 0 : memref<?x?x?xf32>
%N = dim %A, 1 : memref<?x?x?xf32>
%P = dim %A, 2 : memref<?x?x?xf32>
// Permutation maps used in vectorization.
// CHECK: #[[map_proj_d0d1d2_d2d0:map[0-9]+]] = (d0, d1, d2) -> (d2, d0)
-mlfunc @vec2d(%A : memref<?x?x?xf32>) {
+func @vec2d(%A : memref<?x?x?xf32>) {
%M = dim %A, 0 : memref<?x?x?xf32>
%N = dim %A, 1 : memref<?x?x?xf32>
%P = dim %A, 2 : memref<?x?x?xf32>
return
}
-mlfunc @vec2d_imperfectly_nested(%A : memref<?x?x?xf32>) {
+func @vec2d_imperfectly_nested(%A : memref<?x?x?xf32>) {
%0 = dim %A, 0 : memref<?x?x?xf32>
%1 = dim %A, 1 : memref<?x?x?xf32>
%2 = dim %A, 2 : memref<?x?x?xf32>
// Permutation maps used in vectorization.
// CHECK-DAG: #[[map_proj_d0d1d2_d2d1:map[0-9]+]] = (d0, d1, d2) -> (d2, d1)
-mlfunc @vec2d(%A : memref<?x?x?xf32>) {
+func @vec2d(%A : memref<?x?x?xf32>) {
%M = dim %A, 0 : memref<?x?x?xf32>
%N = dim %A, 1 : memref<?x?x?xf32>
%P = dim %A, 2 : memref<?x?x?xf32>
return
}
-mlfunc @vec2d_imperfectly_nested(%A : memref<?x?x?xf32>) {
+func @vec2d_imperfectly_nested(%A : memref<?x?x?xf32>) {
%0 = dim %A, 0 : memref<?x?x?xf32>
%1 = dim %A, 1 : memref<?x?x?xf32>
%2 = dim %A, 2 : memref<?x?x?xf32>
// RUN: mlir-opt %s -canonicalize | FileCheck %s
-// CHECK-LABEL: mlfunc @test_subi_zero
-mlfunc @test_subi_zero(%arg0: i32) -> i32 {
+// CHECK-LABEL: func @test_subi_zero
+func @test_subi_zero(%arg0: i32) -> i32 {
// CHECK-NEXT: %c0_i32 = constant 0 : i32
// CHECK-NEXT: return %c0
%y = subi %arg0, %arg0 : i32
return %y: i32
}
-// CHECK-LABEL: cfgfunc @test_subi_zero_cfg(%arg0: i32)
-cfgfunc @test_subi_zero_cfg(%arg0: i32) -> i32 {
+// CHECK-LABEL: func @test_subi_zero_cfg(%arg0: i32)
+func @test_subi_zero_cfg(%arg0: i32) -> i32 {
// CHECK-NEXT: %c0_i32 = constant 0 : i32
// CHECK-NEXT: return %c0
%y = subi %arg0, %arg0 : i32
return %y: i32
}
-// CHECK-LABEL: mlfunc @dim
-mlfunc @dim(%arg0: tensor<8x4xf32>) -> index {
+// CHECK-LABEL: func @dim
+func @dim(%arg0: tensor<8x4xf32>) -> index {
// CHECK: %c4 = constant 4 : index
%0 = dim %arg0, 1 : tensor<8x4xf32>
return %0 : index
}
-// CHECK-LABEL: mlfunc @test_commutative
-mlfunc @test_commutative(%arg0: i32) -> (i32, i32) {
+// CHECK-LABEL: func @test_commutative
+func @test_commutative(%arg0: i32) -> (i32, i32) {
// CHECK: %c42_i32 = constant 42 : i32
%c42_i32 = constant 42 : i32
// CHECK-NEXT: %0 = addi %arg0, %c42_i32 : i32
return %y, %z: i32, i32
}
-// CHECK-LABEL: mlfunc @trivial_dce
-mlfunc @trivial_dce(%arg0: tensor<8x4xf32>) {
+// CHECK-LABEL: func @trivial_dce
+func @trivial_dce(%arg0: tensor<8x4xf32>) {
%0 = dim %arg0, 1 : tensor<8x4xf32>
// CHECK-NEXT: return
return
}
-// CHECK-LABEL: mlfunc @addi_zero
-mlfunc @addi_zero(%arg0: i32) -> i32 {
+// CHECK-LABEL: func @addi_zero
+func @addi_zero(%arg0: i32) -> i32 {
// CHECK-NEXT: return %arg0
%c0_i32 = constant 0 : i32
%y = addi %c0_i32, %arg0 : i32
return %y: i32
}
-// CHECK-LABEL: mlfunc @addi_zero_vector
-mlfunc @addi_zero_vector(%arg0: vector<4 x i32>) -> vector<4 x i32> {
+// CHECK-LABEL: func @addi_zero_vector
+func @addi_zero_vector(%arg0: vector<4 x i32>) -> vector<4 x i32> {
// CHECK-NEXT: return %arg0
%c0_v4i32 = constant splat<vector<4 x i32>, 0> : vector<4 x i32>
%y = addi %c0_v4i32, %arg0 : vector<4 x i32>
return %y: vector<4 x i32>
}
-// CHECK-LABEL: mlfunc @addi_zero_tensor
-mlfunc @addi_zero_tensor(%arg0: tensor<4 x 5 x i32>) -> tensor<4 x 5 x i32> {
+// CHECK-LABEL: func @addi_zero_tensor
+func @addi_zero_tensor(%arg0: tensor<4 x 5 x i32>) -> tensor<4 x 5 x i32> {
// CHECK-NEXT: return %arg0
%c0_t45i32 = constant splat<tensor<4 x 5 x i32>, 0> : tensor<4 x 5 x i32>
%y = addi %arg0, %c0_t45i32 : tensor<4 x 5 x i32>
return %y: tensor<4 x 5 x i32>
}
-// CHECK-LABEL: mlfunc @muli_one
-mlfunc @muli_one(%arg0: i32) -> i32 {
+// CHECK-LABEL: func @muli_one
+func @muli_one(%arg0: i32) -> i32 {
// CHECK-NEXT: return %arg0
%c0_i32 = constant 1 : i32
%y = muli %c0_i32, %arg0 : i32
return %y: i32
}
-// CHECK-LABEL: mlfunc @muli_one_vector
-mlfunc @muli_one_vector(%arg0: vector<4 x i32>) -> vector<4 x i32> {
+// CHECK-LABEL: func @muli_one_vector
+func @muli_one_vector(%arg0: vector<4 x i32>) -> vector<4 x i32> {
// CHECK-NEXT: return %arg0
%c1_v4i32 = constant splat<vector<4 x i32>, 1> : vector<4 x i32>
%y = muli %c1_v4i32, %arg0 : vector<4 x i32>
return %y: vector<4 x i32>
}
-// CHECK-LABEL: mlfunc @muli_one_tensor
-mlfunc @muli_one_tensor(%arg0: tensor<4 x 5 x i32>) -> tensor<4 x 5 x i32> {
+// CHECK-LABEL: func @muli_one_tensor
+func @muli_one_tensor(%arg0: tensor<4 x 5 x i32>) -> tensor<4 x 5 x i32> {
// CHECK-NEXT: return %arg0
%c1_t45i32 = constant splat<tensor<4 x 5 x i32>, 1> : tensor<4 x 5 x i32>
%y = muli %arg0, %c1_t45i32 : tensor<4 x 5 x i32>
return %y: tensor<4 x 5 x i32>
}
-// CHECK-LABEL: mlfunc @memref_cast_folding
-mlfunc @memref_cast_folding(%arg0: memref<4 x f32>, %arg1: f32) -> f32 {
+// CHECK-LABEL: func @memref_cast_folding
+func @memref_cast_folding(%arg0: memref<4 x f32>, %arg1: f32) -> f32 {
%1 = memref_cast %arg0 : memref<4xf32> to memref<?xf32>
// CHECK-NEXT: %c0 = constant 0 : index
return %0 : f32
}
-// CHECK-LABEL: mlfunc @alloc_const_fold
-mlfunc @alloc_const_fold() -> memref<?xf32> {
+// CHECK-LABEL: func @alloc_const_fold
+func @alloc_const_fold() -> memref<?xf32> {
// CHECK-NEXT: %0 = alloc() : memref<4xf32>
%c4 = constant 4 : index
%a = alloc(%c4) : memref<?xf32>
}
-// CHECK-LABEL: mlfunc @dyn_shape_fold(%arg0: index, %arg1: index)
-mlfunc @dyn_shape_fold(%L : index, %M : index) -> memref<? x ? x f32> {
+// CHECK-LABEL: func @dyn_shape_fold(%arg0: index, %arg1: index)
+func @dyn_shape_fold(%L : index, %M : index) -> memref<? x ? x f32> {
// CHECK: %c0 = constant 0 : index
%zero = constant 0 : index
// The constants below disappear after they propagate into shapes.
return %d : memref<? x ? x f32>
}
-// CHECK-LABEL: mlfunc @merge_constants
-mlfunc @merge_constants() -> (index, index) {
+// CHECK-LABEL: func @merge_constants
+func @merge_constants() -> (index, index) {
// CHECK-NEXT: %c42 = constant 42 : index
%0 = constant 42 : index
%1 = constant 42 : index
return %0, %1: index, index
}
-// CHECK-LABEL: mlfunc @hoist_constant
-mlfunc @hoist_constant(%arg0: memref<8xi32>) {
+// CHECK-LABEL: func @hoist_constant
+func @hoist_constant(%arg0: memref<8xi32>) {
// CHECK-NEXT: %c42_i32 = constant 42 : i32
// CHECK-NEXT: for %i0 = 0 to 8 {
for %i0 = 0 to 8 {
return
}
-// CHECK-LABEL: mlfunc @const_fold_propagate
-mlfunc @const_fold_propagate() -> memref<?x?xf32> {
+// CHECK-LABEL: func @const_fold_propagate
+func @const_fold_propagate() -> memref<?x?xf32> {
%VT_i = constant 512 : index
%VT_i_s = affine_apply (d0) -> (d0 floordiv 8) (%VT_i)
// Affine maps for test case: arg_used_as_dim_and_symbol
// CHECK: [[MAP14:#map[0-9]+]] = (d0, d1, d2, d3)[s0, s1] -> (d2, d3 + s0 + s1 - (d0 + d1))
-// CHECK-LABEL: mlfunc @compose_affine_maps_1dto2d_no_symbols() {
-mlfunc @compose_affine_maps_1dto2d_no_symbols() {
+// CHECK-LABEL: func @compose_affine_maps_1dto2d_no_symbols() {
+func @compose_affine_maps_1dto2d_no_symbols() {
%0 = alloc() : memref<4x4xf32>
for %i0 = 0 to 15 {
return
}
-// CHECK-LABEL: mlfunc @compose_affine_maps_1dto2d_with_symbols() {
-mlfunc @compose_affine_maps_1dto2d_with_symbols() {
+// CHECK-LABEL: func @compose_affine_maps_1dto2d_with_symbols() {
+func @compose_affine_maps_1dto2d_with_symbols() {
%0 = alloc() : memref<4x4xf32>
for %i0 = 0 to 15 {
return
}
-// CHECK-LABEL: mlfunc @compose_affine_maps_2d_tile() {
-mlfunc @compose_affine_maps_2d_tile() {
+// CHECK-LABEL: func @compose_affine_maps_2d_tile() {
+func @compose_affine_maps_2d_tile() {
%0 = alloc() : memref<16x32xf32>
%1 = alloc() : memref<16x32xf32>
return
}
-// CHECK-LABEL: mlfunc @compose_affine_maps_dependent_loads() {
-mlfunc @compose_affine_maps_dependent_loads() {
+// CHECK-LABEL: func @compose_affine_maps_dependent_loads() {
+func @compose_affine_maps_dependent_loads() {
%0 = alloc() : memref<16x32xf32>
%1 = alloc() : memref<16x32xf32>
return
}
-// CHECK-LABEL: mlfunc @compose_affine_maps_diamond_dependency() {
-mlfunc @compose_affine_maps_diamond_dependency() {
+// CHECK-LABEL: func @compose_affine_maps_diamond_dependency() {
+func @compose_affine_maps_diamond_dependency() {
%0 = alloc() : memref<4x4xf32>
for %i0 = 0 to 15 {
return
}
-// CHECK-LABEL: mlfunc @arg_used_as_dim_and_symbol(%arg0: memref<100x100xf32>, %arg1: index) {
-mlfunc @arg_used_as_dim_and_symbol(%arg0: memref<100x100xf32>, %arg1: index) {
+// CHECK-LABEL: func @arg_used_as_dim_and_symbol(%arg0: memref<100x100xf32>, %arg1: index) {
+func @arg_used_as_dim_and_symbol(%arg0: memref<100x100xf32>, %arg1: index) {
%c9 = constant 9 : index
%1 = alloc() : memref<100x100xf32, 1>
%2 = alloc() : memref<1xi32>
// CHECK: [[MAP1:#map[0-9]+]] = ()[s0] -> (100, s0)
// CHECK-LABEL: @test(%arg0: memref<f32>) {
-mlfunc @test(%p : memref<f32>) {
+func @test(%p : memref<f32>) {
for %i0 = 0 to 128 {
for %i1 = 0 to 8 { // CHECK: for %i1 = 0 to 8 {
%0 = constant 4.5 : f32
return
}
-// CHECK-LABEL: cfgfunc @simple_addf
-cfgfunc @simple_addf() -> f32 {
+// CHECK-LABEL: func @simple_addf
+func @simple_addf() -> f32 {
%0 = constant 4.5 : f32
%1 = constant 1.5 : f32
return %2 : f32
}
-// CHECK-LABEL: cfgfunc @simple_addi
-cfgfunc @simple_addi() -> i32 {
+// CHECK-LABEL: func @simple_addi
+func @simple_addi() -> i32 {
%0 = constant 1 : i32
%1 = constant 5 : i32
return %2 : i32
}
-// CHECK-LABEL: cfgfunc @simple_subf
-cfgfunc @simple_subf() -> f32 {
+// CHECK-LABEL: func @simple_subf
+func @simple_subf() -> f32 {
%0 = constant 4.5 : f32
%1 = constant 1.5 : f32
return %2 : f32
}
-// CHECK-LABEL: cfgfunc @simple_subi
-cfgfunc @simple_subi() -> i32 {
+// CHECK-LABEL: func @simple_subi
+func @simple_subi() -> i32 {
%0 = constant 4 : i32
%1 = constant 1 : i32
return %2 : i32
}
-// CHECK-LABEL: mlfunc @affine_apply
-mlfunc @affine_apply(%variable : index) -> (index, index, index) {
+// CHECK-LABEL: func @affine_apply
+func @affine_apply(%variable : index) -> (index, index, index) {
%c177 = constant 177 : index
%c211 = constant 211 : index
%N = constant 1075 : index
return %x#0, %x#1, %y : index, index, index
}
-// CHECK-LABEL: mlfunc @constant_fold_bounds(%arg0: index) {
-mlfunc @constant_fold_bounds(%N : index) {
+// CHECK-LABEL: func @constant_fold_bounds(%arg0: index) {
+func @constant_fold_bounds(%N : index) {
// CHECK: %c3 = constant 3 : index
// CHECK-NEXT: %0 = "foo"() : () -> index
%c9 = constant 9 : index
}
-// CHECK-LABEL: cfgfunc @simple_mulf
-cfgfunc @simple_mulf() -> f32 {
+// CHECK-LABEL: func @simple_mulf
+func @simple_mulf() -> f32 {
%0 = constant 4.5 : f32
%1 = constant 1.5 : f32
return %2 : f32
}
-// CHECK-LABEL: cfgfunc @muli(%arg0: i32)
-cfgfunc @muli(i32) -> (i32, i32) {
+// CHECK-LABEL: func @muli(%arg0: i32)
+func @muli(i32) -> (i32, i32) {
^bb0(%a : i32):
%0 = constant 4 : i32
%1 = constant 2 : i32
return %2, %3 : i32, i32
}
-// CHECK-LABEL: mlfunc @dim
-mlfunc @dim(%x : tensor<8x4xf32>) -> index {
+// CHECK-LABEL: func @dim
+func @dim(%x : tensor<8x4xf32>) -> index {
// CHECK: %c4 = constant 4 : index
%0 = dim %x, 1 : tensor<8x4xf32>
#map0 = (d0) -> (d0 mod 2, d0 mod 2)
// CHECK-LABEL: @simple_constant_ml
-mlfunc @simple_constant_ml() -> (i32, i32) {
+func @simple_constant_ml() -> (i32, i32) {
// CHECK: %c1_i32 = constant 1 : i32
%0 = constant 1 : i32
%1 = constant 1 : i32
}
// CHECK-LABEL: @simple_constant_cfg
-cfgfunc @simple_constant_cfg() -> (i32, i32) {
+func @simple_constant_cfg() -> (i32, i32) {
// CHECK-NEXT: %c1_i32 = constant 1 : i32
%0 = constant 1 : i32
}
// CHECK-LABEL: @basic_ml
-mlfunc @basic_ml() -> (index, index) {
+func @basic_ml() -> (index, index) {
// CHECK: %c0 = constant 0 : index
%c0 = constant 0 : index
%c1 = constant 0 : index
}
// CHECK-LABEL: @many_cfg
-cfgfunc @many_cfg(f32, f32) -> (f32) {
+func @many_cfg(f32, f32) -> (f32) {
^bb0(%a : f32, %b : f32):
// CHECK-NEXT: %0 = addf %arg0, %arg1 : f32
%c = addf %a, %b : f32
/// Check that operations are not eliminated if they have different operands.
// CHECK-LABEL: @different_ops_ml
-mlfunc @different_ops_ml() -> (i32, i32) {
+func @different_ops_ml() -> (i32, i32) {
// CHECK: %c0_i32 = constant 0 : i32
// CHECK: %c1_i32 = constant 1 : i32
%0 = constant 0 : i32
/// Check that operations are not eliminated if they have different result
/// types.
// CHECK-LABEL: @different_results_ml
-mlfunc @different_results_ml(%arg0: tensor<*xf32>) -> (tensor<?x?xf32>, tensor<4x?xf32>) {
+func @different_results_ml(%arg0: tensor<*xf32>) -> (tensor<?x?xf32>, tensor<4x?xf32>) {
// CHECK: %0 = tensor_cast %arg0 : tensor<*xf32> to tensor<?x?xf32>
// CHECK-NEXT: %1 = tensor_cast %arg0 : tensor<*xf32> to tensor<4x?xf32>
%0 = tensor_cast %arg0 : tensor<*xf32> to tensor<?x?xf32>
/// Check that operations are not eliminated if they have different attributes.
// CHECK-LABEL: @different_attributes_cfg
-cfgfunc @different_attributes_cfg(index, index) -> (i1, i1, i1) {
+func @different_attributes_cfg(index, index) -> (i1, i1, i1) {
^bb0(%a : index, %b : index):
// CHECK: %0 = cmpi "slt", %arg0, %arg1 : index
%0 = cmpi "slt", %a, %b : index
/// Check that operations with side effects are not eliminated.
// CHECK-LABEL: @side_effect_ml
-mlfunc @side_effect_ml() -> (memref<2x1xf32>, memref<2x1xf32>) {
+func @side_effect_ml() -> (memref<2x1xf32>, memref<2x1xf32>) {
// CHECK: %0 = alloc() : memref<2x1xf32>
%0 = alloc() : memref<2x1xf32>
/// Check that operation definitions are properly propagated down the dominance
/// tree.
// CHECK-LABEL: @down_propagate_for_ml
-mlfunc @down_propagate_for_ml() {
+func @down_propagate_for_ml() {
// CHECK: %c1_i32 = constant 1 : i32
%0 = constant 1 : i32
}
// CHECK-LABEL: @down_propagate_cfg
-cfgfunc @down_propagate_cfg() -> i32 {
+func @down_propagate_cfg() -> i32 {
// CHECK-NEXT: %c1_i32 = constant 1 : i32
%0 = constant 1 : i32
/// Check that operation definitions are NOT propagated up the dominance tree.
// CHECK-LABEL: @up_propagate_ml
-mlfunc @up_propagate_ml() -> i32 {
+func @up_propagate_ml() -> i32 {
// CHECK: for %i0 = 0 to 4 {
for %i = 0 to 4 {
// CHECK-NEXT: %c1_i32 = constant 1 : i32
return %1 : i32
}
-// CHECK-LABEL: cfgfunc @up_propagate_cfg
-cfgfunc @up_propagate_cfg() -> i32 {
+// CHECK-LABEL: func @up_propagate_cfg
+func @up_propagate_cfg() -> i32 {
// CHECK-NEXT: %c0_i32 = constant 0 : i32
%0 = constant 0 : i32
// CHECK-DAG: [[MAP_ORIG_ACCESS:#map[0-9]+]] = (d0, d1)[s0, s1] -> (d0, d1 + s0 + s1)
// CHECK-DAG: [[MAP_SUB_OFFSET:#map[0-9]+]] = (d0, d1, d2) -> (d1, d2 - (d0 + 9))
-// CHECK-LABEL: mlfunc @loop_nest_1d() {
-mlfunc @loop_nest_1d() {
+// CHECK-LABEL: func @loop_nest_1d() {
+func @loop_nest_1d() {
%A = alloc() : memref<256 x f32>
%B = alloc() : memref<512 x f32>
%F = alloc() : memref<256 x f32, 1>
return
}
-// CHECK-LABEL: mlfunc @loop_nest_high_d
+// CHECK-LABEL: func @loop_nest_high_d
// CHECK: %c16384 = constant 16384 : index
// CHECK-NEXT: %0 = alloc() : memref<512x32xf32, 1>
// CHECK-NEXT: %1 = alloc() : memref<1xi32>
// CHECK-NEXT: dma_wait %6[%c0], %c16384 : memref<1xi32>
// CHECK-NEXT: return
// CHECK-NEXT:}
-mlfunc @loop_nest_high_d(%A: memref<512 x 32 x f32>,
+func @loop_nest_high_d(%A: memref<512 x 32 x f32>,
%B: memref<512 x 32 x f32>, %C: memref<512 x 32 x f32>) {
// DMAs will be performed at this level (jT is the first loop without a stride).
// A and B are read, while C is both read and written. A total of three new buffers
// A loop nest with a modulo 2 access. A strided DMA is not needed here a 1x2
// region within a 256 x 8 memref.
//
-// CHECK-LABEL: mlfunc @loop_nest_modulo() {
+// CHECK-LABEL: func @loop_nest_modulo() {
// CHECK: %0 = alloc() : memref<256x8xf32>
// CHECK-NEXT: for %i0 = 0 to 32 step 4 {
// CHECK-NEXT: %1 = affine_apply #map{{[0-9]+}}(%i0)
// CHECK: }
// CHECK-NEXT: }
// CHECK-NEXT: return
-mlfunc @loop_nest_modulo() {
+func @loop_nest_modulo() {
%A = alloc() : memref<256 x 8 x f32>
for %i = 0 to 32 step 4 {
// DMAs will be performed at this level (%j is the first unit stride loop)
// DMA on tiled loop nest. This also tests the case where the bounds are
// dependent on outer loop IVs.
-// CHECK-LABEL: mlfunc @loop_nest_tiled() -> memref<256x1024xf32> {
-mlfunc @loop_nest_tiled() -> memref<256x1024xf32> {
+// CHECK-LABEL: func @loop_nest_tiled() -> memref<256x1024xf32> {
+func @loop_nest_tiled() -> memref<256x1024xf32> {
%0 = alloc() : memref<256x1024xf32>
for %i0 = 0 to 256 step 32 {
for %i1 = 0 to 1024 step 32 {
return %0 : memref<256x1024xf32>
}
-// CHECK-LABEL: mlfunc @dma_constant_dim_access
-mlfunc @dma_constant_dim_access(%A : memref<100x100xf32>) {
+// CHECK-LABEL: func @dma_constant_dim_access
+func @dma_constant_dim_access(%A : memref<100x100xf32>) {
%one = constant 1 : index
%N = constant 100 : index
// CHECK: %0 = alloc() : memref<1x100xf32, 1>
return
}
-// CHECK-LABEL: mlfunc @dma_with_symbolic_accesses
-mlfunc @dma_with_symbolic_accesses(%A : memref<100x100xf32>, %M : index) {
+// CHECK-LABEL: func @dma_with_symbolic_accesses
+func @dma_with_symbolic_accesses(%A : memref<100x100xf32>, %M : index) {
%N = constant 9 : index
for %i = 0 to 100 {
for %j = 0 to 100 {
// CHECK-NEXT: return
}
-// CHECK-LABEL: mlfunc @dma_with_symbolic_loop_bounds
-mlfunc @dma_with_symbolic_loop_bounds(%A : memref<100x100xf32>, %M : index, %N: index) {
+// CHECK-LABEL: func @dma_with_symbolic_loop_bounds
+func @dma_with_symbolic_loop_bounds(%A : memref<100x100xf32>, %M : index, %N: index) {
%K = constant 9 : index
// The buffer size can't be bound by a constant smaller than the original
// memref size; so the DMA buffer is the entire 100x100.
return
}
-// CHECK-LABEL: mlfunc @dma_unknown_size
-mlfunc @dma_unknown_size(%arg0: memref<?x?xf32>) {
+// CHECK-LABEL: func @dma_unknown_size
+func @dma_unknown_size(%arg0: memref<?x?xf32>) {
%M = dim %arg0, 0 : memref<? x ? x f32>
%N = dim %arg0, 0 : memref<? x ? x f32>
for %i = 0 to %M {
return
}
-// CHECK-LABEL: mlfunc @dma_memref_3d
-mlfunc @dma_memref_3d(%arg0: memref<1024x1024x1024xf32>) {
+// CHECK-LABEL: func @dma_memref_3d
+func @dma_memref_3d(%arg0: memref<1024x1024x1024xf32>) {
for %i = 0 to 1024 {
for %j = 0 to 1024 {
for %k = 0 to 1024 {
// added to iteration domain in dependence check.
// *) Add a test w/ floordiv/ceildiv/mod when supported in dependence check.
// *) Add tests which check fused computation slice indexing and loop bounds.
-// TODO(andydavis) Test clean up: move memref allocs to mlfunc args.
+// TODO(andydavis) Test clean up: move memref allocs to func args.
// -----
// CHECK: [[MAP0:#map[0-9]+]] = (d0) -> (d0)
-// CHECK-LABEL: mlfunc @should_fuse_raw_dep_for_locality() {
-mlfunc @should_fuse_raw_dep_for_locality() {
+// CHECK-LABEL: func @should_fuse_raw_dep_for_locality() {
+func @should_fuse_raw_dep_for_locality() {
%m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
// CHECK: [[MAP0:#map[0-9]+]] = (d0) -> (d0)
-// CHECK-LABEL: mlfunc @should_fuse_reduction_to_pointwise() {
-mlfunc @should_fuse_reduction_to_pointwise() {
+// CHECK-LABEL: func @should_fuse_reduction_to_pointwise() {
+func @should_fuse_reduction_to_pointwise() {
%a = alloc() : memref<10x10xf32>
%b = alloc() : memref<10xf32>
%c = alloc() : memref<10xf32>
// CHECK: [[MAP_SHIFT_MINUS_ONE:#map[0-9]+]] = (d0) -> (d0 - 1)
// CHECK: [[MAP_SHIFT_BY_ONE:#map[0-9]+]] = (d0, d1) -> (d0 + 1, d1 + 1)
-// CHECK-LABEL: mlfunc @should_fuse_loop_nests_with_shifts() {
-mlfunc @should_fuse_loop_nests_with_shifts() {
+// CHECK-LABEL: func @should_fuse_loop_nests_with_shifts() {
+func @should_fuse_loop_nests_with_shifts() {
%a = alloc() : memref<10x10xf32>
%cf7 = constant 7.0 : f32
// CHECK: [[MAP_IDENTITY:#map[0-9]+]] = (d0) -> (d0)
-// CHECK-LABEL: mlfunc @should_fuse_loop_nest() {
-mlfunc @should_fuse_loop_nest() {
+// CHECK-LABEL: func @should_fuse_loop_nest() {
+func @should_fuse_loop_nest() {
%a = alloc() : memref<10x10xf32>
%b = alloc() : memref<10x10xf32>
%cf7 = constant 7.0 : f32
// CHECK: [[MAP0:#map[0-9]+]] = (d0) -> (d0)
-// CHECK-LABEL: mlfunc @should_fuse_across_intermediate_loop_with_no_deps() {
-mlfunc @should_fuse_across_intermediate_loop_with_no_deps() {
+// CHECK-LABEL: func @should_fuse_across_intermediate_loop_with_no_deps() {
+func @should_fuse_across_intermediate_loop_with_no_deps() {
%a = alloc() : memref<10xf32>
%b = alloc() : memref<10xf32>
%c = alloc() : memref<10xf32>
// CHECK: [[MAP0:#map[0-9]+]] = (d0) -> (d0)
-// CHECK-LABEL: mlfunc @should_fuse_all_loops() {
-mlfunc @should_fuse_all_loops() {
+// CHECK-LABEL: func @should_fuse_all_loops() {
+func @should_fuse_all_loops() {
%a = alloc() : memref<10xf32>
%b = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
// CHECK: [[MAP0:#map[0-9]+]] = (d0) -> (d0)
-// CHECK-LABEL: mlfunc @should_fuse_first_and_second_loops() {
-mlfunc @should_fuse_first_and_second_loops() {
+// CHECK-LABEL: func @should_fuse_first_and_second_loops() {
+func @should_fuse_first_and_second_loops() {
%a = alloc() : memref<10xf32>
%b = alloc() : memref<10xf32>
%c = alloc() : memref<10xf32>
// -----
-// CHECK-LABEL: mlfunc @should_not_fuse_would_create_cycle() {
-mlfunc @should_not_fuse_would_create_cycle() {
+// CHECK-LABEL: func @should_not_fuse_would_create_cycle() {
+func @should_not_fuse_would_create_cycle() {
%a = alloc() : memref<10xf32>
%b = alloc() : memref<10xf32>
%c = alloc() : memref<10xf32>
// -----
-// CHECK-LABEL: mlfunc @should_not_fuse_raw_dep_would_be_violated() {
-mlfunc @should_not_fuse_raw_dep_would_be_violated() {
+// CHECK-LABEL: func @should_not_fuse_raw_dep_would_be_violated() {
+func @should_not_fuse_raw_dep_would_be_violated() {
%m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
// -----
-// CHECK-LABEL: mlfunc @should_not_fuse_waw_dep_would_be_violated() {
-mlfunc @should_not_fuse_waw_dep_would_be_violated() {
+// CHECK-LABEL: func @should_not_fuse_waw_dep_would_be_violated() {
+func @should_not_fuse_waw_dep_would_be_violated() {
%m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
// -----
-// CHECK-LABEL: mlfunc @should_not_fuse_war_dep_would_be_violated() {
-mlfunc @should_not_fuse_war_dep_would_be_violated() {
+// CHECK-LABEL: func @should_not_fuse_war_dep_would_be_violated() {
+func @should_not_fuse_war_dep_would_be_violated() {
%a = alloc() : memref<10xf32>
%b = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
// -----
-// CHECK-LABEL: mlfunc @should_not_fuse_if_top_level_access() {
-mlfunc @should_not_fuse_if_top_level_access() {
+// CHECK-LABEL: func @should_not_fuse_if_top_level_access() {
+func @should_not_fuse_if_top_level_access() {
%m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
// CHECK: [[MAP0:#map[0-9]+]] = (d0) -> (d0)
-// CHECK-LABEL: mlfunc @should_fuse_no_top_level_access() {
-mlfunc @should_fuse_no_top_level_access() {
+// CHECK-LABEL: func @should_fuse_no_top_level_access() {
+func @should_fuse_no_top_level_access() {
%m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
#set0 = (d0) : (1 == 0)
-// CHECK-LABEL: mlfunc @should_not_fuse_if_inst_at_top_level() {
-mlfunc @should_not_fuse_if_inst_at_top_level() {
+// CHECK-LABEL: func @should_not_fuse_if_inst_at_top_level() {
+func @should_not_fuse_if_inst_at_top_level() {
%m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
#set0 = (d0) : (1 == 0)
-// CHECK-LABEL: mlfunc @should_not_fuse_if_inst_in_loop_nest() {
-mlfunc @should_not_fuse_if_inst_in_loop_nest() {
+// CHECK-LABEL: func @should_not_fuse_if_inst_in_loop_nest() {
+func @should_not_fuse_if_inst_in_loop_nest() {
%m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
%c4 = constant 4 : index
// CHECK: [[MAP1:#map[0-9]+]] = (d0, d1, d2) -> (d0, d1, d2)
// CHECK: [[MAP2:#map[0-9]+]] = (d0, d1, d2) -> (d1, d2, d0)
-// CHECK-LABEL: mlfunc @remap_ivs() {
-mlfunc @remap_ivs() {
+// CHECK-LABEL: func @remap_ivs() {
+func @remap_ivs() {
%m = alloc() : memref<10x20x30xf32>
%cf7 = constant 7.0 : f32
// DEPTH1: #map0 = (d0) -> (d0)
// DEPTH1: #map1 = (d0, d1, d2) -> (d0, d1, d2)
-// DEPTH1-LABEL: mlfunc @fuse_slice_at_depth1() {
-mlfunc @fuse_slice_at_depth1() {
+// DEPTH1-LABEL: func @fuse_slice_at_depth1() {
+func @fuse_slice_at_depth1() {
%m = alloc() : memref<100x16x100xf32>
%cf7 = constant 7.0 : f32
// CHECK-DAG: [[UB:#map[0-9]+]] = ()[s0, s1] -> (s0, 4096 floordiv s1)
// CHECK-DAG: [[UB_INTRA_TILE:#map[0-9]+]] = (d0, d1, d2) -> (d2 + 32, s0, 4096 floordiv s1)
-// CHECK-LABEL: mlfunc @loop_tiling()
+// CHECK-LABEL: func @loop_tiling()
// CHECK-NEXT: for %i0 = 0 to 256 step 32 {
// CHECK-NEXT: for %i1 = 0 to 512 step 32 {
// CHECK-NEXT: for %i2 = 0 to 1024 step 32 {
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: return
-mlfunc @loop_tiling() {
+func @loop_tiling() {
for %i = 0 to 256 {
for %j = 0 to 512 {
for %k = 0 to 1024 {
#lb = ()[s0] -> (0, s0)
#ub = ()[s0, s1] -> (s0, 4096 floordiv s1)
-// CHECK-LABEL: mlfunc @loop_max_min_bound(%arg0: memref<?xi32>, %arg1: index, %arg2: index) {
-mlfunc @loop_max_min_bound(%A : memref<? x i32>, %L : index, %U : index) {
+// CHECK-LABEL: func @loop_max_min_bound(%arg0: memref<?xi32>, %arg1: index, %arg2: index) {
+func @loop_max_min_bound(%A : memref<? x i32>, %L : index, %U : index) {
%M = dim %A, 0 : memref<? x i32>
for %iTT = max #lb()[%L] to min #ub()[%M, %U] {
%out = affine_apply (d0) -> (d0) (%iTT)
#map5 = (d0,d1,d2) -> (d0,d1,d2)
#map6 = (d0,d1,d2) -> (d0 + d1 + d2)
-// CHECK-LABEL: cfgfunc @affine_applies()
-cfgfunc @affine_applies() {
+// CHECK-LABEL: func @affine_applies()
+func @affine_applies() {
^bb0:
// CHECK: %c0 = constant 0 : index
%zero = affine_apply #map0()
return
}
-// CHECK-LABEL: cfgfunc @multiresult_affine_apply()
-cfgfunc @multiresult_affine_apply() {
+// CHECK-LABEL: func @multiresult_affine_apply()
+func @multiresult_affine_apply() {
// CHECK-NEXT: %c1 = constant 1 : index
// CHECK-NEXT: %0 = addi %c1, %c1 : index
// CHECK-NEXT: %1 = addi %0, %c1 : index
return
}
-// CHECK-LABEL: cfgfunc @args_ret_affine_apply(%arg0: index, %arg1: index)
-cfgfunc @args_ret_affine_apply(index, index) -> (index, index) {
+// CHECK-LABEL: func @args_ret_affine_apply(%arg0: index, %arg1: index)
+func @args_ret_affine_apply(index, index) -> (index, index) {
^bb0(%0 : index, %1 : index):
// CHECK-NEXT: return %arg0, %arg1 : index, index
%00 = affine_apply #map2 (%0)
// CHECK-DAG: [[setMapS2:#map[0-9]+]] = (d0)[s0, s1, s2, s3] -> (s2 - 1)
// CHECK-DAG: [[setMapS3:#map[0-9]+]] = (d0)[s0, s1, s2, s3] -> (s3 - 42)
-// CHECK-LABEL: cfgfunc @empty() {
-mlfunc @empty() {
+// CHECK-LABEL: func @empty() {
+func @empty() {
return // CHECK: return
} // CHECK: }
-extfunc @body(index) -> ()
+func @body(index) -> ()
// Simple loops are properly converted.
-// CHECK-LABEL: cfgfunc @simple_loop() {
+// CHECK-LABEL: func @simple_loop() {
// CHECK-NEXT: %0 = affine_apply [[map1]]()
// CHECK-NEXT: %1 = affine_apply [[map42]]()
// CHECK-NEXT: br ^bb1(%0 : index)
// CHECK-NEXT: ^bb3: // pred: ^bb1
// CHECK-NEXT: return
// CHECK-NEXT: }
-mlfunc @simple_loop() {
+func @simple_loop() {
for %i = 1 to 42 {
call @body(%i) : (index) -> ()
}
// Direct calls get renamed if asked (IR data structures properly updated) and
// keep the same name otherwise.
-cfgfunc @simple_caller() {
+func @simple_caller() {
^bb0:
// CHECK: call @simple_loop() : () -> ()
call @simple_loop() : () -> ()
// Constant loads get renamed if asked (IR data structure properly updated) and
// keep the same name otherwise.
-cfgfunc @simple_indirect_caller() {
+func @simple_indirect_caller() {
^bb0:
// CHECK: %f = constant @simple_loop : () -> ()
%f = constant @simple_loop : () -> ()
return
}
-cfgfunc @nested_attributes() {
+func @nested_attributes() {
^bb0:
%0 = constant 0 : index
// CHECK: call @body(%c0) {attr1: [@simple_loop : () -> (), @simple_loop : () -> ()]} : (index) -> ()
return
}
-// CHECK-LABEL: cfgfunc @ml_caller() {
-mlfunc @ml_caller() {
+// CHECK-LABEL: func @ml_caller() {
+func @ml_caller() {
// Direct calls inside ML functions are renamed if asked (given that the
// function itself is also converted).
// CHECK: call @simple_loop() : () -> ()
/////////////////////////////////////////////////////////////////////
-extfunc @body_args(index) -> (index)
-extfunc @other(index, i32) -> (i32)
+func @body_args(index) -> (index)
+func @other(index, i32) -> (i32)
// Arguments and return values of the functions are converted.
-// CHECK-LABEL: cfgfunc @mlfunc_args(%arg0: i32, %arg1: i32) -> (i32, i32) {
+// CHECK-LABEL: func @func_args(%arg0: i32, %arg1: i32) -> (i32, i32) {
// CHECK-NEXT: %c0_i32 = constant 0 : i32
// CHECK-NEXT: %0 = affine_apply [[map0]]()
// CHECK-NEXT: %1 = affine_apply [[map42]]()
// CHECK-NEXT: %9 = call @other(%c0, %c0_i32) : (index, i32) -> i32
// CHECK-NEXT: return %c0_i32, %9 : i32, i32
// CHECK-NEXT: }
-mlfunc @mlfunc_args(%a : i32, %b : i32) -> (i32, i32) {
+func @func_args(%a : i32, %b : i32) -> (i32, i32) {
%r1 = constant 0 : i32
for %i = 0 to 42 {
%1 = call @body_args(%i) : (index) -> (index)
/////////////////////////////////////////////////////////////////////
-extfunc @pre(index) -> ()
-extfunc @body2(index, index) -> ()
-extfunc @post(index) -> ()
+func @pre(index) -> ()
+func @body2(index, index) -> ()
+func @post(index) -> ()
-// CHECK-LABEL: cfgfunc @imperfectly_nested_loops() {
+// CHECK-LABEL: func @imperfectly_nested_loops() {
// CHECK-NEXT: %0 = affine_apply [[map0]]()
// CHECK-NEXT: %1 = affine_apply [[map42]]()
// CHECK-NEXT: br ^bb1(%0 : index)
// CHECK-NEXT: ^bb6: // pred: ^bb1
// CHECK-NEXT: return
// CHECK-NEXT: }
-mlfunc @imperfectly_nested_loops() {
+func @imperfectly_nested_loops() {
for %i = 0 to 42 {
call @pre(%i) : (index) -> ()
for %j = 7 to 56 step 2 {
/////////////////////////////////////////////////////////////////////
-extfunc @mid(index) -> ()
-extfunc @body3(index, index) -> ()
+func @mid(index) -> ()
+func @body3(index, index) -> ()
-// CHECK-LABEL: cfgfunc @more_imperfectly_nested_loops() {
+// CHECK-LABEL: func @more_imperfectly_nested_loops() {
// CHECK-NEXT: %0 = affine_apply [[map0]]()
// CHECK-NEXT: %1 = affine_apply [[map42]]()
// CHECK-NEXT: br ^bb1(%0 : index)
// CHECK-NEXT: ^bb9: // pred: ^bb1
// CHECK-NEXT: return
// CHECK-NEXT: }
-mlfunc @more_imperfectly_nested_loops() {
+func @more_imperfectly_nested_loops() {
for %i = 0 to 42 {
call @pre(%i) : (index) -> ()
for %j = 7 to 56 step 2 {
return
}
-// CHECK-LABEL: cfgfunc @affine_apply_loops_shorthand(%arg0: index) {
+// CHECK-LABEL: func @affine_apply_loops_shorthand(%arg0: index) {
// CHECK-NEXT: %0 = affine_apply #map3()
// CHECK-NEXT: %1 = affine_apply #map10()[%arg0]
// CHECK-NEXT: br ^bb1(%0 : index)
// CHECK-NEXT: ^bb6: // pred: ^bb1
// CHECK-NEXT: return
// CHECK-NEXT: }
-mlfunc @affine_apply_loops_shorthand(%N : index) {
+func @affine_apply_loops_shorthand(%N : index) {
for %i = 0 to %N {
for %j = %i to 42 {
call @body2(%i, %j) : (index, index) -> ()
/////////////////////////////////////////////////////////////////////
-extfunc @get_idx() -> (index)
+func @get_idx() -> (index)
#set1 = (d0) : (20 - d0 >= 0)
#set2 = (d0) : (d0 - 10 >= 0)
-// CHECK-LABEL: cfgfunc @if_only() {
+// CHECK-LABEL: func @if_only() {
// CHECK-NEXT: %0 = call @get_idx() : () -> index
// CHECK-NEXT: %c0 = constant 0 : index
// CHECK-NEXT: %1 = affine_apply [[setMap20]](%0)
// CHECK-NEXT: [[endBB]]:
// CHECK-NEXT: return
// CHECK-NEXT: }
-mlfunc @if_only() {
+func @if_only() {
%i = call @get_idx() : () -> (index)
if #set1(%i) {
call @body(%i) : (index) -> ()
return
}
-// CHECK-LABEL: cfgfunc @if_else() {
+// CHECK-LABEL: func @if_else() {
// CHECK-NEXT: %0 = call @get_idx() : () -> index
// CHECK-NEXT: %c0 = constant 0 : index
// CHECK-NEXT: %1 = affine_apply [[setMap20]](%0)
// CHECK-NEXT: [[endBB]]:
// CHECK-NEXT: return
// CHECK-NEXT: }
-mlfunc @if_else() {
+func @if_else() {
%i = call @get_idx() : () -> (index)
if #set1(%i) {
call @body(%i) : (index) -> ()
return
}
-// CHECK-LABEL: cfgfunc @nested_ifs() {
+// CHECK-LABEL: func @nested_ifs() {
// CHECK-NEXT: %0 = call @get_idx() : () -> index
// CHECK-NEXT: %c0 = constant 0 : index
// CHECK-NEXT: %1 = affine_apply #map12(%0)
// CHECK-NEXT: ^bb7: // 2 preds: ^bb3, ^bb6
// CHECK-NEXT: return
// CHECK-NEXT: }
-mlfunc @nested_ifs() {
+func @nested_ifs() {
%i = call @get_idx() : () -> (index)
if #set1(%i) {
if #set2(%i) {
#setN = (d0)[N,M,K,L] : (N - d0 + 1 >= 0, N - 1 >= 0, M - 1 >= 0, K - 1 >= 0, L - 42 == 0)
-// CHECK-LABEL: cfgfunc @multi_cond(%arg0: index, %arg1: index, %arg2: index, %arg3: index) {
+// CHECK-LABEL: func @multi_cond(%arg0: index, %arg1: index, %arg2: index, %arg3: index) {
// CHECK-NEXT: %0 = call @get_idx() : () -> index
// CHECK-NEXT: %c0 = constant 0 : index
// CHECK-NEXT: %1 = affine_apply [[setMapDiff]](%0)[%arg0, %arg1, %arg2, %arg3]
// CHECK-NEXT: [[endBB]]:
// CHECK-NEXT: return
// CHECK-NEXT: }
-mlfunc @multi_cond(%N : index, %M : index, %K : index, %L : index) {
+func @multi_cond(%N : index, %M : index, %K : index, %L : index) {
%i = call @get_idx() : () -> (index)
if #setN(%i)[%N,%M,%K,%L] {
call @body(%i) : (index) -> ()
return
}
-// CHECK-LABEL: cfgfunc @if_for() {
-mlfunc @if_for() {
+// CHECK-LABEL: func @if_for() {
+func @if_for() {
// CHECK-NEXT: %0 = call @get_idx() : () -> index
%i = call @get_idx() : () -> (index)
// CHECK-NEXT: %c0 = constant 0 : index
#lbMultiMap = (d0)[s0] -> (d0, s0 - d0)
#ubMultiMap = (d0)[s0] -> (s0, d0 + 10)
-// CHECK-LABEL: cfgfunc @loop_min_max(%arg0: index) {
+// CHECK-LABEL: func @loop_min_max(%arg0: index) {
// CHECK-NEXT: %{{[0-9]+}} = affine_apply [[map0]]()
// CHECK-NEXT: %{{[0-9]+}} = affine_apply [[map42]]()
// CHECK-NEXT: br ^bb1(%{{[0-9]+}} : index)
// CHECK-NEXT: ^bb6: // pred: ^bb1
// CHECK-NEXT: return
// CHECK-NEXT: }
-mlfunc @loop_min_max(%N : index) {
+func @loop_min_max(%N : index) {
for %i = 0 to 42 {
for %j = max #lbMultiMap(%i)[%N] to min #ubMultiMap(%i)[%N] {
call @body2(%i, %j) : (index, index) -> ()
// Check that the "min" (cmpi "slt" + select) reduction sequence is emitted
// correctly for a an affine map with 7 results.
-// CHECK-LABEL: cfgfunc @min_reduction_tree(%arg0: index) {
+// CHECK-LABEL: func @min_reduction_tree(%arg0: index) {
// CHECK-NEXT: %{{[0-9]+}} = affine_apply [[map0]]()
// CHECK-NEXT: %[[applr:[0-9]+]] = affine_apply [[multi7Map]](%arg0)
// CHECK-NEXT: %[[c01:.+]] = cmpi "slt", %[[applr]]#0, %[[applr]]#1 : index
// CHECK-NEXT: ^bb3: // pred: ^bb1
// CHECK-NEXT: return
// CHECK-NEXT: }
-mlfunc @min_reduction_tree(%v : index) {
+func @min_reduction_tree(%v : index) {
for %i = 0 to min #map_7_values(%v)[] {
call @body(%i) : (index) -> ()
}
// -----
-// CHECK-LABEL: mlfunc @test() {
-mlfunc @test() {
+// CHECK-LABEL: func @test() {
+func @test() {
%zero = constant 0 : index
%minusone = constant -1 : index
%sym = constant 111 : index
return
}
-// CHECK-LABEL: mlfunc @test_mod_floordiv_ceildiv
-mlfunc @test_mod_floordiv_ceildiv() {
+// CHECK-LABEL: func @test_mod_floordiv_ceildiv
+func @test_mod_floordiv_ceildiv() {
%zero = constant 0 : index
%A = alloc() : memref<128 x 64 x 64 x i32>
return
}
-// CHECK-LABEL: mlfunc @test_no_out_of_bounds()
-mlfunc @test_no_out_of_bounds() {
+// CHECK-LABEL: func @test_no_out_of_bounds()
+func @test_no_out_of_bounds() {
%zero = constant 0 : index
%A = alloc() : memref<257 x 256 x i32>
%C = alloc() : memref<257 x i32>
return
}
-// CHECK-LABEL: mlfunc @mod_div
-mlfunc @mod_div() {
+// CHECK-LABEL: func @mod_div
+func @mod_div() {
%zero = constant 0 : index
%A = alloc() : memref<128 x 64 x 64 x i32>
}
// Tests with nested mod's and floordiv's.
-// CHECK-LABEL: mlfunc @mod_floordiv_nested() {
-mlfunc @mod_floordiv_nested() {
+// CHECK-LABEL: func @mod_floordiv_nested() {
+func @mod_floordiv_nested() {
%A = alloc() : memref<256 x 256 x i32>
for %i = 0 to 256 {
for %j = 0 to 256 {
return
}
-// CHECK-LABEL: mlfunc @test_semi_affine_bailout
-mlfunc @test_semi_affine_bailout(%N : index) {
+// CHECK-LABEL: func @test_semi_affine_bailout
+func @test_semi_affine_bailout(%N : index) {
%B = alloc() : memref<10 x i32>
for %i = 0 to 10 {
%idx = affine_apply (d0)[s0] -> (d0 * s0)(%i)[%N]
return
}
-// CHECK-LABEL: mlfunc @multi_mod_floordiv
-mlfunc @multi_mod_floordiv() {
+// CHECK-LABEL: func @multi_mod_floordiv
+func @multi_mod_floordiv() {
%A = alloc() : memref<2x2xi32>
for %ii = 0 to 64 {
%idx = affine_apply (d0) -> ((d0 mod 147456) floordiv 1152,
return
}
-// CHECK-LABEL: mlfunc @delinearize_mod_floordiv
-mlfunc @delinearize_mod_floordiv() {
+// CHECK-LABEL: func @delinearize_mod_floordiv
+func @delinearize_mod_floordiv() {
%c0 = constant 0 : index
%in = alloc() : memref<2x2x3x3x16x1xi32>
%out = alloc() : memref<64x9xi32>
// RUN: mlir-opt %s -memref-dataflow-opt -verify | FileCheck %s
-// CHECK-LABEL: mlfunc @simple_store_load() {
-mlfunc @simple_store_load() {
+// CHECK-LABEL: func @simple_store_load() {
+func @simple_store_load() {
%cf7 = constant 7.0 : f32
%m = alloc() : memref<10xf32>
for %i0 = 0 to 10 {
// CHECK-NEXT: return
}
-// CHECK-LABEL: mlfunc @multi_store_load() {
-mlfunc @multi_store_load() {
+// CHECK-LABEL: func @multi_store_load() {
+func @multi_store_load() {
%c0 = constant 0 : index
%cf7 = constant 7.0 : f32
%cf8 = constant 8.0 : f32
// The store-load forwarding can see through affine apply's since it relies on
// dependence information.
-// CHECK-LABEL: mlfunc @store_load_affine_apply
-mlfunc @store_load_affine_apply() -> memref<10x10xf32> {
+// CHECK-LABEL: func @store_load_affine_apply
+func @store_load_affine_apply() -> memref<10x10xf32> {
%cf7 = constant 7.0 : f32
%m = alloc() : memref<10x10xf32>
for %i0 = 0 to 10 {
// CHECK-NEXT: return %0 : memref<10x10xf32>
}
-// CHECK-LABEL: mlfunc @store_load_nested
-mlfunc @store_load_nested(%N : index) {
+// CHECK-LABEL: func @store_load_nested
+func @store_load_nested(%N : index) {
%cf7 = constant 7.0 : f32
%m = alloc() : memref<10xf32>
for %i0 = 0 to 10 {
// No forwarding happens here since either of the two stores could be the last
// writer; store/load forwarding will however be possible here once loop live
// out SSA scalars are available.
-// CHECK-LABEL: mlfunc @multi_store_load_nested_no_fwd
-mlfunc @multi_store_load_nested_no_fwd(%N : index) {
+// CHECK-LABEL: func @multi_store_load_nested_no_fwd
+func @multi_store_load_nested_no_fwd(%N : index) {
%cf7 = constant 7.0 : f32
%cf8 = constant 8.0 : f32
%m = alloc() : memref<10xf32>
// No forwarding happens here since both stores have a value going into
// the load.
-// CHECK-LABEL: mlfunc @store_load_store_nested_no_fwd
-mlfunc @store_load_store_nested_no_fwd(%N : index) {
+// CHECK-LABEL: func @store_load_store_nested_no_fwd
+func @store_load_store_nested_no_fwd(%N : index) {
%cf7 = constant 7.0 : f32
%cf9 = constant 9.0 : f32
%m = alloc() : memref<10xf32>
// Forwarding happens here since the last store postdominates all other stores
// and other forwarding criteria are satisfied.
-// CHECK-LABEL: mlfunc @multi_store_load_nested_fwd
-mlfunc @multi_store_load_nested_fwd(%N : index) {
+// CHECK-LABEL: func @multi_store_load_nested_fwd
+func @multi_store_load_nested_fwd(%N : index) {
%cf7 = constant 7.0 : f32
%cf8 = constant 8.0 : f32
%cf9 = constant 9.0 : f32
}
// No one-to-one dependence here between the store and load.
-// CHECK-LABEL: mlfunc @store_load_no_fwd
-mlfunc @store_load_no_fwd() {
+// CHECK-LABEL: func @store_load_no_fwd
+func @store_load_no_fwd() {
%cf7 = constant 7.0 : f32
%m = alloc() : memref<10xf32>
for %i0 = 0 to 10 {
}
// Forwarding happens here as there is a one-to-one store-load correspondence.
-// CHECK-LABEL: mlfunc @store_load_fwd
-mlfunc @store_load_fwd() {
+// CHECK-LABEL: func @store_load_fwd
+func @store_load_fwd() {
%cf7 = constant 7.0 : f32
%c0 = constant 0 : index
%m = alloc() : memref<10xf32>
// Although there is a dependence from the second store to the load, it is
// satisfied by the outer surrounding loop, and does not prevent the first
// store to be forwarded to the load.
-mlfunc @store_load_store_nested_fwd(%N : index) -> f32 {
+func @store_load_store_nested_fwd(%N : index) -> f32 {
%cf7 = constant 7.0 : f32
%cf9 = constant 9.0 : f32
%c0 = constant 0 : index
#set0 = (d0) : (1 == 0)
-// CHECK-LABEL: mlfunc @store_may_execute_before_load() {
-mlfunc @store_may_execute_before_load() {
+// CHECK-LABEL: func @store_may_execute_before_load() {
+func @store_may_execute_before_load() {
%m = alloc() : memref<10xf32>
%cf7 = constant 7.0 : f32
%c0 = constant 4 : index
// -----
-// CHECK-LABEL: mlfunc @dependent_loops() {
-mlfunc @dependent_loops() {
+// CHECK-LABEL: func @dependent_loops() {
+func @dependent_loops() {
%0 = alloc() : memref<10xf32>
%cst = constant 7.000000e+00 : f32
// There is a dependence from 0 to 1 at depth 1 (common surrounding loops 0)
}
// -----
-// CHECK-LABEL: mlfunc @different_memrefs() {
-mlfunc @different_memrefs() {
+// CHECK-LABEL: func @different_memrefs() {
+func @different_memrefs() {
%m.a = alloc() : memref<100xf32>
%m.b = alloc() : memref<100xf32>
%c0 = constant 0 : index
}
// -----
-// CHECK-LABEL: mlfunc @store_load_different_elements() {
-mlfunc @store_load_different_elements() {
+// CHECK-LABEL: func @store_load_different_elements() {
+func @store_load_different_elements() {
%m = alloc() : memref<100xf32>
%c0 = constant 0 : index
%c1 = constant 1 : index
}
// -----
-// CHECK-LABEL: mlfunc @load_store_different_elements() {
-mlfunc @load_store_different_elements() {
+// CHECK-LABEL: func @load_store_different_elements() {
+func @load_store_different_elements() {
%m = alloc() : memref<100xf32>
%c0 = constant 0 : index
%c1 = constant 1 : index
}
// -----
-// CHECK-LABEL: mlfunc @store_load_same_element() {
-mlfunc @store_load_same_element() {
+// CHECK-LABEL: func @store_load_same_element() {
+func @store_load_same_element() {
%m = alloc() : memref<100xf32>
%c11 = constant 11 : index
%c7 = constant 7.0 : f32
}
// -----
-// CHECK-LABEL: mlfunc @load_load_same_element() {
-mlfunc @load_load_same_element() {
+// CHECK-LABEL: func @load_load_same_element() {
+func @load_load_same_element() {
%m = alloc() : memref<100xf32>
%c11 = constant 11 : index
%c7 = constant 7.0 : f32
}
// -----
-// CHECK-LABEL: mlfunc @store_load_same_symbol(%arg0: index) {
-mlfunc @store_load_same_symbol(%arg0: index) {
+// CHECK-LABEL: func @store_load_same_symbol(%arg0: index) {
+func @store_load_same_symbol(%arg0: index) {
%m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
store %c7, %m[%arg0] : memref<100xf32>
}
// -----
-// CHECK-LABEL: mlfunc @store_load_different_symbols(%arg0: index, %arg1: index) {
-mlfunc @store_load_different_symbols(%arg0: index, %arg1: index) {
+// CHECK-LABEL: func @store_load_different_symbols(%arg0: index, %arg1: index) {
+func @store_load_different_symbols(%arg0: index, %arg1: index) {
%m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
store %c7, %m[%arg0] : memref<100xf32>
}
// -----
-// CHECK-LABEL: mlfunc @store_load_diff_element_affine_apply_const() {
-mlfunc @store_load_diff_element_affine_apply_const() {
+// CHECK-LABEL: func @store_load_diff_element_affine_apply_const() {
+func @store_load_diff_element_affine_apply_const() {
%m = alloc() : memref<100xf32>
%c1 = constant 1 : index
%c8 = constant 8.0 : f32
}
// -----
-// CHECK-LABEL: mlfunc @store_load_same_element_affine_apply_const() {
-mlfunc @store_load_same_element_affine_apply_const() {
+// CHECK-LABEL: func @store_load_same_element_affine_apply_const() {
+func @store_load_same_element_affine_apply_const() {
%m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
%c9 = constant 9 : index
}
// -----
-// CHECK-LABEL: mlfunc @store_load_affine_apply_symbol(%arg0: index) {
-mlfunc @store_load_affine_apply_symbol(%arg0: index) {
+// CHECK-LABEL: func @store_load_affine_apply_symbol(%arg0: index) {
+func @store_load_affine_apply_symbol(%arg0: index) {
%m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
%a0 = affine_apply (d0) -> (d0) (%arg0)
}
// -----
-// CHECK-LABEL: mlfunc @store_load_affine_apply_symbol_offset(%arg0: index) {
-mlfunc @store_load_affine_apply_symbol_offset(%arg0: index) {
+// CHECK-LABEL: func @store_load_affine_apply_symbol_offset(%arg0: index) {
+func @store_load_affine_apply_symbol_offset(%arg0: index) {
%m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
%a0 = affine_apply (d0) -> (d0) (%arg0)
}
// -----
-// CHECK-LABEL: mlfunc @store_range_load_after_range() {
-mlfunc @store_range_load_after_range() {
+// CHECK-LABEL: func @store_range_load_after_range() {
+func @store_range_load_after_range() {
%m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
%c10 = constant 10 : index
}
// -----
-// CHECK-LABEL: mlfunc @store_load_func_symbol(%arg0: index, %arg1: index) {
-mlfunc @store_load_func_symbol(%arg0: index, %arg1: index) {
+// CHECK-LABEL: func @store_load_func_symbol(%arg0: index, %arg1: index) {
+func @store_load_func_symbol(%arg0: index, %arg1: index) {
%m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
%c10 = constant 10 : index
}
// -----
-// CHECK-LABEL: mlfunc @store_range_load_last_in_range() {
-mlfunc @store_range_load_last_in_range() {
+// CHECK-LABEL: func @store_range_load_last_in_range() {
+func @store_range_load_last_in_range() {
%m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
%c10 = constant 10 : index
}
// -----
-// CHECK-LABEL: mlfunc @store_range_load_before_range() {
-mlfunc @store_range_load_before_range() {
+// CHECK-LABEL: func @store_range_load_before_range() {
+func @store_range_load_before_range() {
%m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
%c0 = constant 0 : index
}
// -----
-// CHECK-LABEL: mlfunc @store_range_load_first_in_range() {
-mlfunc @store_range_load_first_in_range() {
+// CHECK-LABEL: func @store_range_load_first_in_range() {
+func @store_range_load_first_in_range() {
%m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
%c0 = constant 0 : index
}
// -----
-// CHECK-LABEL: mlfunc @store_plus_3() {
-mlfunc @store_plus_3() {
+// CHECK-LABEL: func @store_plus_3() {
+func @store_plus_3() {
%m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
for %i0 = 1 to 11 {
}
// -----
-// CHECK-LABEL: mlfunc @load_minus_2() {
-mlfunc @load_minus_2() {
+// CHECK-LABEL: func @load_minus_2() {
+func @load_minus_2() {
%m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
for %i0 = 2 to 11 {
}
// -----
-// CHECK-LABEL: mlfunc @perfectly_nested_loops_loop_independent() {
-mlfunc @perfectly_nested_loops_loop_independent() {
+// CHECK-LABEL: func @perfectly_nested_loops_loop_independent() {
+func @perfectly_nested_loops_loop_independent() {
%m = alloc() : memref<10x10xf32>
%c7 = constant 7.0 : f32
for %i0 = 0 to 11 {
}
// -----
-// CHECK-LABEL: mlfunc @perfectly_nested_loops_loop_carried_at_depth1() {
-mlfunc @perfectly_nested_loops_loop_carried_at_depth1() {
+// CHECK-LABEL: func @perfectly_nested_loops_loop_carried_at_depth1() {
+func @perfectly_nested_loops_loop_carried_at_depth1() {
%m = alloc() : memref<10x10xf32>
%c7 = constant 7.0 : f32
for %i0 = 0 to 9 {
}
// -----
-// CHECK-LABEL: mlfunc @perfectly_nested_loops_loop_carried_at_depth2() {
-mlfunc @perfectly_nested_loops_loop_carried_at_depth2() {
+// CHECK-LABEL: func @perfectly_nested_loops_loop_carried_at_depth2() {
+func @perfectly_nested_loops_loop_carried_at_depth2() {
%m = alloc() : memref<10x10xf32>
%c7 = constant 7.0 : f32
for %i0 = 0 to 10 {
}
// -----
-// CHECK-LABEL: mlfunc @one_common_loop() {
-mlfunc @one_common_loop() {
+// CHECK-LABEL: func @one_common_loop() {
+func @one_common_loop() {
%m = alloc() : memref<10x10xf32>
%c7 = constant 7.0 : f32
// There is a loop-independent dependence from access 0 to 1 at depth 2.
}
// -----
-// CHECK-LABEL: mlfunc @dependence_cycle() {
-mlfunc @dependence_cycle() {
+// CHECK-LABEL: func @dependence_cycle() {
+func @dependence_cycle() {
%m.a = alloc() : memref<100xf32>
%m.b = alloc() : memref<100xf32>
}
// -----
-// CHECK-LABEL: mlfunc @negative_and_positive_direction_vectors(%arg0: index, %arg1: index) {
-mlfunc @negative_and_positive_direction_vectors(%arg0: index, %arg1: index) {
+// CHECK-LABEL: func @negative_and_positive_direction_vectors(%arg0: index, %arg1: index) {
+func @negative_and_positive_direction_vectors(%arg0: index, %arg1: index) {
%m = alloc() : memref<10x10xf32>
%c7 = constant 7.0 : f32
for %i0 = 0 to %arg0 {
}
// -----
-// CHECK-LABEL: mlfunc @war_raw_waw_deps() {
-mlfunc @war_raw_waw_deps() {
+// CHECK-LABEL: func @war_raw_waw_deps() {
+func @war_raw_waw_deps() {
%m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
for %i0 = 0 to 10 {
}
// -----
-// CHECK-LABEL: mlfunc @mod_deps() {
-mlfunc @mod_deps() {
+// CHECK-LABEL: func @mod_deps() {
+func @mod_deps() {
%m = alloc() : memref<100xf32>
%c7 = constant 7.0 : f32
for %i0 = 0 to 10 {
}
// -----
-// CHECK-LABEL: mlfunc @loop_nest_depth() {
-mlfunc @loop_nest_depth() {
+// CHECK-LABEL: func @loop_nest_depth() {
+func @loop_nest_depth() {
%0 = alloc() : memref<100x100xf32>
%c7 = constant 7.0 : f32
// -----
// Test case to exercise sanity when flattening multiple expressions involving
// mod/div's successively.
-// CHECK-LABEL: mlfunc @mod_div_3d() {
-mlfunc @mod_div_3d() {
+// CHECK-LABEL: func @mod_div_3d() {
+func @mod_div_3d() {
%M = alloc() : memref<2x2x2xi32>
%c0 = constant 0 : i32
for %i0 = 0 to 8 {
// -----
// This test case arises in the context of a 6-d to 2-d reshape.
-// CHECK-LABEL: mlfunc @delinearize_mod_floordiv
-mlfunc @delinearize_mod_floordiv() {
+// CHECK-LABEL: func @delinearize_mod_floordiv
+func @delinearize_mod_floordiv() {
%c0 = constant 0 : index
%val = constant 0 : i32
%in = alloc() : memref<2x2x3x3x16x1xi32>
// CHECK-DAG: [[MOD_2:#map[0-9]+]] = (d0) -> (d0 mod 2)
// CHECK-DAG: [[REMAP_SHIFT_MINUS_4:#map[0-9]+]] = (d0) -> (d0 - 4)
-// CHECK-LABEL: mlfunc @loop_nest_dma() {
-mlfunc @loop_nest_dma() {
+// CHECK-LABEL: func @loop_nest_dma() {
+func @loop_nest_dma() {
// CHECK: %0 = alloc() : memref<256xf32>
// CHECK: %1 = alloc() : memref<2x32xf32, 1>
// CHECK: %2 = alloc() : memref<2x1xf32>
}
// CHECK-LABEL: @loop_step
-mlfunc @loop_step(%arg0: memref<512xf32>,
+func @loop_step(%arg0: memref<512xf32>,
%arg1: memref<512xf32>) {
%c0 = constant 0 : index
%c4 = constant 4 : index
#map0 = (d0, d1) -> (d0, d1)
#map1 = (d0, d1) -> ((d0 * 2048 + d1 * 256) floordiv 32, 0)
#map2 = (d0) -> ((d0 * 2048) floordiv 32, 0)
-// CHECK: mlfunc @loop_dma_nested(%arg0: memref<512x32xvector<8xf32>
-mlfunc @loop_dma_nested(%arg0: memref<512x32xvector<8xf32>, #map0>, %arg1: memref<512x32xvector<8xf32>, #map0>, %arg2: memref<512x32xvector<8xf32>, #map0>) {
+// CHECK: func @loop_dma_nested(%arg0: memref<512x32xvector<8xf32>
+func @loop_dma_nested(%arg0: memref<512x32xvector<8xf32>, #map0>, %arg1: memref<512x32xvector<8xf32>, #map0>, %arg2: memref<512x32xvector<8xf32>, #map0>) {
%num_elts = constant 256 : index
%c0 = constant 0 : index
%0 = alloc() : memref<64x4xvector<8xf32>, #map0, 2>
return // CHECK-NEXT: return
}
-// CHECK: mlfunc @loop_dma_dependent
-mlfunc @loop_dma_dependent(%arg2: memref<512x32xvector<8xf32>>) {
+// CHECK: func @loop_dma_dependent
+func @loop_dma_dependent(%arg2: memref<512x32xvector<8xf32>>) {
%num_elts = constant 256 : index
%c0 = constant 0 : index
%0 = alloc() : memref<64x4xvector<8xf32>, 2>
return // CHECK-NEXT: return
}
-// CHECK-LABEL: mlfunc @escaping_use
-mlfunc @escaping_use(%arg0: memref<512 x 32 x f32>) {
+// CHECK-LABEL: func @escaping_use
+func @escaping_use(%arg0: memref<512 x 32 x f32>) {
%c32 = constant 32 : index
%num_elt = constant 512 : index
%zero = constant 0 : index
// CHECK-NEXT: return
}
-// CHECK-LABEL: mlfunc @live_out_use
-mlfunc @live_out_use(%arg0: memref<512 x 32 x f32>) -> f32 {
+// CHECK-LABEL: func @live_out_use
+func @live_out_use(%arg0: memref<512 x 32 x f32>) -> f32 {
%c32 = constant 32 : index
%num_elt = constant 512 : index
%zero = constant 0 : index
// CHECK-NEXT: return
}
-// CHECK-LABEL: mlfunc @dynamic_shape_dma_buffer
-mlfunc @dynamic_shape_dma_buffer(%arg0: memref<512 x 32 x f32>) {
+// CHECK-LABEL: func @dynamic_shape_dma_buffer
+func @dynamic_shape_dma_buffer(%arg0: memref<512 x 32 x f32>) {
%c32 = constant 32 : index
%num_elt = constant 512 : index
%zero = constant 0 : index
d0 * 7 + d1 * 5 + s0 * 11 + s1 == 0,
d0 - 1 == 0, d0 + 2 == 0)
-mlfunc @test() {
+func @test() {
for %n0 = 0 to 127 {
for %n1 = 0 to 7 {
%x = affine_apply #map0(%n0, %n1)
return
}
-// CHECK-LABEL: mlfunc @test_gaussian_elimination_empty_set0() {
-mlfunc @test_gaussian_elimination_empty_set0() {
+// CHECK-LABEL: func @test_gaussian_elimination_empty_set0() {
+func @test_gaussian_elimination_empty_set0() {
for %i0 = 1 to 10 {
for %i1 = 1 to 100 {
// CHECK: [[SET_EMPTY_2D]](%i0, %i1)
return
}
-// CHECK-LABEL: mlfunc @test_gaussian_elimination_empty_set1() {
-mlfunc @test_gaussian_elimination_empty_set1() {
+// CHECK-LABEL: func @test_gaussian_elimination_empty_set1() {
+func @test_gaussian_elimination_empty_set1() {
for %i0 = 1 to 10 {
for %i1 = 1 to 100 {
// CHECK: [[SET_EMPTY_2D]](%i0, %i1)
return
}
-// CHECK-LABEL: mlfunc @test_gaussian_elimination_non_empty_set2() {
-mlfunc @test_gaussian_elimination_non_empty_set2() {
+// CHECK-LABEL: func @test_gaussian_elimination_non_empty_set2() {
+func @test_gaussian_elimination_non_empty_set2() {
for %i0 = 1 to 10 {
for %i1 = 1 to 100 {
// CHECK: #set1(%i0, %i1)
return
}
-// CHECK-LABEL: mlfunc @test_gaussian_elimination_empty_set3() {
-mlfunc @test_gaussian_elimination_empty_set3() {
+// CHECK-LABEL: func @test_gaussian_elimination_empty_set3() {
+func @test_gaussian_elimination_empty_set3() {
%c7 = constant 7 : index
%c11 = constant 11 : index
for %i0 = 1 to 10 {
return
}
-// CHECK-LABEL: mlfunc @test_gaussian_elimination_non_empty_set4() {
-mlfunc @test_gaussian_elimination_non_empty_set4() {
+// CHECK-LABEL: func @test_gaussian_elimination_non_empty_set4() {
+func @test_gaussian_elimination_non_empty_set4() {
%c7 = constant 7 : index
%c11 = constant 11 : index
for %i0 = 1 to 10 {
return
}
-// CHECK-LABEL: mlfunc @test_gaussian_elimination_empty_set5() {
-mlfunc @test_gaussian_elimination_empty_set5() {
+// CHECK-LABEL: func @test_gaussian_elimination_empty_set5() {
+func @test_gaussian_elimination_empty_set5() {
%c7 = constant 7 : index
%c11 = constant 11 : index
for %i0 = 1 to 10 {
return
}
-// CHECK-LABEL: mlfunc @test_empty_set(%arg0: index) {
-mlfunc @test_empty_set(%N : index) {
+// CHECK-LABEL: func @test_empty_set(%arg0: index) {
+func @test_empty_set(%N : index) {
for %i = 0 to 10 {
for %j = 0 to 10 {
// CHECK: if [[SET_EMPTY_2D]](%i0, %i1)
/// |_______________|
/// |
/// 9
-mlfunc @slicing_test() {
+func @slicing_test() {
// Fake 0 to align on 1 and match ASCII art.
%0 = alloc() : memref<1xi32>
// This should be matched to M1, but M1 is defined later.
// CHECK: {{#map[0-9]+}} = ()[s0] -> (s0 + 8)
-// CHECK-LABEL: mlfunc @unroll_jam_imperfect_nest() {
-mlfunc @unroll_jam_imperfect_nest() {
+// CHECK-LABEL: func @unroll_jam_imperfect_nest() {
+func @unroll_jam_imperfect_nest() {
// CHECK: %c100 = constant 100 : index
// CHECK-NEXT: for %i0 = 0 to 99 step 2 {
for %i = 0 to 101 {
return
}
-// UNROLL-BY-4-LABEL: mlfunc @loop_nest_unknown_count_1(%arg0: index) {
-mlfunc @loop_nest_unknown_count_1(%N : index) {
+// UNROLL-BY-4-LABEL: func @loop_nest_unknown_count_1(%arg0: index) {
+func @loop_nest_unknown_count_1(%N : index) {
// UNROLL-BY-4-NEXT: for %i0 = 1 to #map{{[0-9]+}}()[%arg0] step 4 {
// UNROLL-BY-4-NEXT: for %i1 = 1 to 100 {
// UNROLL-BY-4-NEXT: %0 = "foo"() : () -> i32
return
}
-// UNROLL-BY-4-LABEL: mlfunc @loop_nest_unknown_count_2(%arg0: index) {
-mlfunc @loop_nest_unknown_count_2(%arg : index) {
+// UNROLL-BY-4-LABEL: func @loop_nest_unknown_count_2(%arg0: index) {
+func @loop_nest_unknown_count_2(%arg : index) {
// UNROLL-BY-4-NEXT: for %i0 = %arg0 to #map{{[0-9]+}}()[%arg0] step 4 {
// UNROLL-BY-4-NEXT: for %i1 = 1 to 100 {
// UNROLL-BY-4-NEXT: %0 = "foo"(%i0) : (index) -> i32
// UNROLL-BY-4: #map8 = (d0) -> (d0 + 10)
// UNROLL-BY-4: #map9 = (d0) -> (d0 + 15)
-// CHECK-LABEL: mlfunc @loop_nest_simplest() {
-mlfunc @loop_nest_simplest() {
+// CHECK-LABEL: func @loop_nest_simplest() {
+func @loop_nest_simplest() {
// CHECK: for %i0 = 0 to 100 step 2 {
for %i = 0 to 100 step 2 {
// CHECK: %c1_i32 = constant 1 : i32
return // CHECK: return
} // CHECK }
-// CHECK-LABEL: mlfunc @loop_nest_simple_iv_use() {
-mlfunc @loop_nest_simple_iv_use() {
+// CHECK-LABEL: func @loop_nest_simple_iv_use() {
+func @loop_nest_simple_iv_use() {
// CHECK: %c0 = constant 0 : index
// CHECK-NEXT: for %i0 = 0 to 100 step 2 {
for %i = 0 to 100 step 2 {
} // CHECK }
// Operations in the loop body have results that are used therein.
-// CHECK-LABEL: mlfunc @loop_nest_body_def_use() {
-mlfunc @loop_nest_body_def_use() {
+// CHECK-LABEL: func @loop_nest_body_def_use() {
+func @loop_nest_body_def_use() {
// CHECK: %c0 = constant 0 : index
// CHECK-NEXT: for %i0 = 0 to 100 step 2 {
for %i = 0 to 100 step 2 {
return // CHECK: return
} // CHECK }
-// CHECK-LABEL: mlfunc @loop_nest_strided() {
-mlfunc @loop_nest_strided() {
+// CHECK-LABEL: func @loop_nest_strided() {
+func @loop_nest_strided() {
// CHECK: %c2 = constant 2 : index
// CHECK-NEXT: %c2_0 = constant 2 : index
// CHECK-NEXT: for %i0 = 0 to 100 {
return // CHECK: return
} // CHECK }
-// CHECK-LABEL: mlfunc @loop_nest_multiple_results() {
-mlfunc @loop_nest_multiple_results() {
+// CHECK-LABEL: func @loop_nest_multiple_results() {
+func @loop_nest_multiple_results() {
// CHECK: %c0 = constant 0 : index
// CHECK-NEXT: for %i0 = 0 to 100 {
for %i = 0 to 100 {
// Imperfect loop nest. Unrolling innermost here yields a perfect nest.
-// CHECK-LABEL: mlfunc @loop_nest_seq_imperfect(%arg0: memref<128x128xf32>) {
-mlfunc @loop_nest_seq_imperfect(%a : memref<128x128xf32>) {
+// CHECK-LABEL: func @loop_nest_seq_imperfect(%arg0: memref<128x128xf32>) {
+func @loop_nest_seq_imperfect(%a : memref<128x128xf32>) {
// CHECK: %c0 = constant 0 : index
// CHECK-NEXT: %c128 = constant 128 : index
%c128 = constant 128 : index
return // CHECK: return
}
-// CHECK-LABEL: mlfunc @loop_nest_seq_multiple() {
-mlfunc @loop_nest_seq_multiple() {
+// CHECK-LABEL: func @loop_nest_seq_multiple() {
+func @loop_nest_seq_multiple() {
// CHECK: c0 = constant 0 : index
// CHECK-NEXT: %c0_0 = constant 0 : index
// CHECK-NEXT: %0 = affine_apply #map0(%c0_0)
return // CHECK: return
} // CHECK }
-// SHORT-LABEL: mlfunc @loop_nest_outer_unroll() {
-mlfunc @loop_nest_outer_unroll() {
+// SHORT-LABEL: func @loop_nest_outer_unroll() {
+func @loop_nest_outer_unroll() {
// SHORT: for %i0 = 0 to 4 {
// SHORT-NEXT: %0 = affine_apply #map0(%i0)
// SHORT-NEXT: %1 = "addi32"(%0, %0) : (index, index) -> index
// We aren't doing any file check here. We just need this test case to
// successfully run. Both %i0 and i1 will get unrolled here with the min trip
// count threshold set to 2.
-// SHORT-LABEL: mlfunc @loop_nest_seq_long() -> i32 {
-mlfunc @loop_nest_seq_long() -> i32 {
+// SHORT-LABEL: func @loop_nest_seq_long() -> i32 {
+func @loop_nest_seq_long() -> i32 {
%A = alloc() : memref<512 x 512 x i32, (d0, d1) -> (d0, d1), 2>
%B = alloc() : memref<512 x 512 x i32, (d0, d1) -> (d0, d1), 2>
%C = alloc() : memref<512 x 512 x i32, (d0, d1) -> (d0, d1), 2>
return %ret : i32
}
-// UNROLL-BY-4-LABEL: mlfunc @unroll_unit_stride_no_cleanup() {
-mlfunc @unroll_unit_stride_no_cleanup() {
+// UNROLL-BY-4-LABEL: func @unroll_unit_stride_no_cleanup() {
+func @unroll_unit_stride_no_cleanup() {
// UNROLL-BY-4: for %i0 = 0 to 100 {
for %i = 0 to 100 {
// UNROLL-BY-4: for [[L1:%i[0-9]+]] = 0 to 8 step 4 {
return
}
-// UNROLL-BY-4-LABEL: mlfunc @unroll_unit_stride_cleanup() {
-mlfunc @unroll_unit_stride_cleanup() {
+// UNROLL-BY-4-LABEL: func @unroll_unit_stride_cleanup() {
+func @unroll_unit_stride_cleanup() {
// UNROLL-BY-4: for %i0 = 0 to 100 {
for %i = 0 to 100 {
// UNROLL-BY-4: for [[L1:%i[0-9]+]] = 0 to 7 step 4 {
return
}
-// UNROLL-BY-4-LABEL: mlfunc @unroll_non_unit_stride_cleanup() {
-mlfunc @unroll_non_unit_stride_cleanup() {
+// UNROLL-BY-4-LABEL: func @unroll_non_unit_stride_cleanup() {
+func @unroll_non_unit_stride_cleanup() {
// UNROLL-BY-4: for %i0 = 0 to 100 {
for %i = 0 to 100 {
// UNROLL-BY-4: for [[L1:%i[0-9]+]] = 2 to 37 step 20 {
}
// Both the unrolled loop and the cleanup loop are single iteration loops.
-mlfunc @loop_nest_single_iteration_after_unroll(%N: index) {
+func @loop_nest_single_iteration_after_unroll(%N: index) {
// UNROLL-BY-4: %c0 = constant 0 : index
// UNROLL-BY-4: %c4 = constant 4 : index
// UNROLL-BY-4: for %i0 = 0 to %arg0 {
// Test cases with loop bound operands.
// No cleanup will be generated here.
-// UNROLL-BY-4-LABEL: mlfunc @loop_nest_operand1() {
-mlfunc @loop_nest_operand1() {
+// UNROLL-BY-4-LABEL: func @loop_nest_operand1() {
+func @loop_nest_operand1() {
// UNROLL-BY-4: for %i0 = 0 to 100 step 2 {
// UNROLL-BY-4-NEXT: for %i1 = (d0) -> (0)(%i0) to #map{{[0-9]+}}(%i0) step 4
// UNROLL-BY-4-NEXT: %0 = "foo"() : () -> i32
}
// No cleanup will be generated here.
-// UNROLL-BY-4-LABEL: mlfunc @loop_nest_operand2() {
-mlfunc @loop_nest_operand2() {
+// UNROLL-BY-4-LABEL: func @loop_nest_operand2() {
+func @loop_nest_operand2() {
// UNROLL-BY-4: for %i0 = 0 to 100 step 2 {
// UNROLL-BY-4-NEXT: for %i1 = (d0) -> (d0)(%i0) to #map{{[0-9]+}}(%i0) step 4 {
// UNROLL-BY-4-NEXT: %0 = "foo"() : () -> i32
// Difference between loop bounds is constant, but not a multiple of unroll
// factor. The cleanup loop happens to be a single iteration one and is promoted.
-// UNROLL-BY-4-LABEL: mlfunc @loop_nest_operand3() {
-mlfunc @loop_nest_operand3() {
+// UNROLL-BY-4-LABEL: func @loop_nest_operand3() {
+func @loop_nest_operand3() {
// UNROLL-BY-4: for %i0 = 0 to 100 step 2 {
for %i = 0 to 100 step 2 {
// UNROLL-BY-4: for %i1 = (d0) -> (d0)(%i0) to #map{{[0-9]+}}(%i0) step 4 {
return
}
-// UNROLL-BY-4-LABEL: mlfunc @loop_nest_operand4(%arg0: index) {
-mlfunc @loop_nest_operand4(%N : index) {
+// UNROLL-BY-4-LABEL: func @loop_nest_operand4(%arg0: index) {
+func @loop_nest_operand4(%N : index) {
// UNROLL-BY-4: for %i0 = 0 to 100 {
for %i = 0 to 100 {
// UNROLL-BY-4: for %i1 = ()[s0] -> (0)()[%arg0] to #map{{[0-9]+}}()[%arg0] step 4 {
return
}
-// CHECK-LABEL: mlfunc @loop_nest_unroll_full() {
-mlfunc @loop_nest_unroll_full() {
+// CHECK-LABEL: func @loop_nest_unroll_full() {
+func @loop_nest_unroll_full() {
// CHECK-NEXT: %0 = "foo"() : () -> i32
// CHECK-NEXT: %1 = "bar"() : () -> i32
// CHECK-NEXT: return