func @foo(%arg0: !llvm.type<"i32">, %arg1: !llvm.type<"i64">) -> !llvm.type<"{i32, i64}"> {
// insert the vales into a structure
- %0 = llvm.undef : !llvm.type<"{i32, i64}">
+ %0 = llvm.mlir.undef : !llvm.type<"{i32, i64}">
%1 = llvm.insertvalue %arg0, %0[0] : !llvm.type<"{i32, i64}">
%2 = llvm.insertvalue %arg1, %1[1] : !llvm.type<"{i32, i64}">
llvm.return %2 : !llvm.type<"{i32, i64}">
}
func @bar() {
- %0 = llvm.constant(42 : i32) : !llvm.type<"i32">
- %1 = llvm.constant(17) : !llvm.type<"i64">
+ %0 = llvm.mlir.constant(42 : i32) : !llvm.type<"i32">
+ %1 = llvm.mlir.constant(17) : !llvm.type<"i64">
// call and extract the values from the structure
%2 = llvm.call @bar(%0, %1) : (%arg0: !llvm.type<"i32">, %arg1: !llvm.type<"i64">) -> !llvm.type<"{i32, i64}">
%b = llvm.extractvalue %m[0] : !llvm.type<"{float*, i64, i64}">
// obtain the components for the index
-%sub1 = llvm.constant(1) : !llvm.type<"i64"> // first subscript
+%sub1 = llvm.mlir.constant(1) : !llvm.type<"i64"> // first subscript
%sz2 = llvm.extractvalue %m[1]
: !llvm.type<"{float*, i64, i64}"> // second size (dynamic, second descriptor element)
-%sub2 = llvm.constant(2) : !llvm.type<"i64"> // second subscript
-%sz3 = llvm.constant(13) : !llvm.type<"i64"> // third size (static)
-%sub3 = llvm.constant(3) : !llvm.type<"i64"> // third subscript
+%sub2 = llvm.mlir.constant(2) : !llvm.type<"i64"> // second subscript
+%sz3 = llvm.mlir.constant(13) : !llvm.type<"i64"> // third size (static)
+%sub3 = llvm.mlir.constant(3) : !llvm.type<"i64"> // third subscript
%sz4 = llvm.extractvalue %m[1]
: !llvm.type<"{float*, i64, i64}"> // fourth size (dynamic, third descriptor element)
-%sub4 = llvm.constant(4) : !llvm.type<"i64"> // fourth subscript
+%sub4 = llvm.mlir.constant(4) : !llvm.type<"i64"> // fourth subscript
// compute the linearized index
// %sub4 + %sub3 * %sz4 + %sub2 * (%sz3 * %sz4) + %sub1 * (%sz2 * %sz3 * %sz4) =
```mlir {.mlir}
// Allocate an array of 4 floats on stack
-%c4 = llvm.constant(4) : !llvm.i64
+%c4 = llvm.mlir.constant(4) : !llvm.i64
%0 = llvm.alloca %c4 x !llvm.float : (!llvm.i64) -> !llvm<"float*">
// Get the second element of the array (note 0-based indexing).
-%c1 = llvm.constant(1) : !llvm.i64
+%c1 = llvm.mlir.constant(1) : !llvm.i64
%1 = llvm.getelementptr %0[%c1] : (!llvm<"float*">, !llvm.i64)
-> !llvm<"float*">
// Store a constant into this element.
-%cf = llvm.constant(42.0 : f32) : !llvm.float
+%cf = llvm.mlir.constant(42.0 : f32) : !llvm.float
llvm.store %cf, %1 : !llvm<"float*">
// Load the value from this element.
Selection: `select <condition>, <lhs>, <rhs>`.
-### Pseudo-operations
+### Auxiliary MLIR operations
These operations do not have LLVM IR counterparts but are necessary to map LLVM
-IR into MLIR.
+IR into MLIR. They should be prefixed with `llvm.mlir`.
-#### `llvm.addressof`
+#### `llvm.mlir.addressof`
Creates an SSA value containing a pointer to a global variable or constant
-defined by `llvm.global`. The global value can be defined after its first
-referenced. If the global value is a constant, storing into it is not allowed.
+defined by `llvm.mlir.global`. The global value can be defined after its first
+referenced. If the global value is a constant, storing into it is not allowed.
Examples:
```mlir {.mlir}
func @foo() {
// Get the address of a global.
- %0 = llvm.addressof @const : !llvm<"i32*">
+ %0 = llvm.mlir.addressof @const : !llvm<"i32*">
// Use it as a regular pointer.
%1 = llvm.load %0 : !llvm<"i32*">
}
// Define the global.
-llvm.global @const(42 : i32) : !llvm.i32
+llvm.mlir.global @const(42 : i32) : !llvm.i32
```
-#### `llvm.constant`
+#### `llvm.mlir.constant`
Unlike LLVM IR, MLIR does not have first-class constant values. Therefore, all
constants must be created as SSA values before being used in other operations.
-`llvm.constant` creates such values for scalars and vectors. It has a mandatory
-`value` attribute, which may be an integer, floating point attribute; splat,
-dense or sparse attribute containing integers or floats. The type of the
+`llvm.mlir.constant` creates such values for scalars and vectors. It has a
+mandatory `value` attribute, which may be an integer, floating point attribute;
+splat, dense or sparse attribute containing integers or floats. The type of the
attribute is one the corresponding MLIR standard types. It may be omitted for
`i64` and `f64` types that are implied. The operation produces a new SSA value
of the specified LLVM IR dialect type. The type of that value _must_ correspond
```mlir {.mlir}
// Integer constant, internal i32 is mandatory
-%0 = llvm.constant(42 : i32) : !llvm.i32
+%0 = llvm.mlir.constant(42 : i32) : !llvm.i32
// It's okay to omit i64.
-%1 = llvm.constant(42) : !llvm.i64
+%1 = llvm.mlir.constant(42) : !llvm.i64
// Floating point constant.
-%2 = llvm.constant(42.0 : f32) : !llvm.float
+%2 = llvm.mlir.constant(42.0 : f32) : !llvm.float
// Splat vector constant,.
-%3 = llvm.constant(splat<vector<4xf32>, 1.0>) : !llvm<"<4 x float>">
+%3 = llvm.mlir.constant(splat<vector<4xf32>, 1.0>) : !llvm<"<4 x float>">
```
-#### `llvm.global`
+#### `llvm.mlir.global`
Since MLIR allows for arbitrary operations to be present at the top level,
-global variables are defined using the `llvm.global` operation. Both global
+global variables are defined using the `llvm.mlir.global` operation. Both global
constants and variables can be defined, and the value must be initialized in
-both cases. The initialization and type syntax is similar to `llvm.constant` and
-may use two types: one for MLIR attribute and another for the LLVM value. These
-types must be compatible. `llvm.global` must appear at top-level of the
-enclosing module. It uses an @-identifier for its value, which will be uniqued
-by the module with respect to other @-identifiers in it.
+both cases. The initialization and type syntax is similar to
+`llvm.mlir.constant` and may use two types: one for MLIR attribute and another
+for the LLVM value. These types must be compatible. `llvm.mlir.global` must
+appear at top-level of the enclosing module. It uses an @-identifier for its
+value, which will be uniqued by the module with respect to other @-identifiers
+in it.
Examples:
```mlir {.mlir}
// Global values use @-identifiers.
-llvm.global constant @cst(42 : i32) : !llvm.i32
+llvm.mlir.global constant @cst(42 : i32) : !llvm.i32
// Non-constant values must also be initialized.
-llvm.global @variable(32.0 : f32) : !llvm.float
+llvm.mlir.global @variable(32.0 : f32) : !llvm.float
// Strings are expected to be of wrapped LLVM i8 array type and do not
// automatically include the trailing zero.
-llvm.global @string("abc") : !llvm<"[3 x i8]">
+llvm.mlir.global @string("abc") : !llvm<"[3 x i8]">
// For strings globals, the trailing type may be omitted.
-llvm.global constant @no_trailing_type("foo bar")
+llvm.mlir.global constant @no_trailing_type("foo bar")
```
-#### `llvm.undef`
+#### `llvm.mlir.undef`
Unlike LLVM IR, MLIR does not have first-class undefined values. Such values
-must be created as SSA values using `llvm.undef`. This operation has no operands
-or attributes. It creates an undefined value of the specified LLVM IR dialect
-type wrapping an LLVM IR structure type.
+must be created as SSA values using `llvm.mlir.undef`. This operation has no
+operands or attributes. It creates an undefined value of the specified LLVM IR
+dialect type wrapping an LLVM IR structure type.
Example:
```mlir {.mlir}
// Create a structure with a 32-bit integer followed by a float.
-%0 = llvm.undef : !llvm<"{i32, float}">
+%0 = llvm.mlir.undef : !llvm<"{i32, float}">
```
%90 = llvm.icmp "slt" %89, %88 : !llvm.i64
llvm.cond_br %90, ^bb2, ^bb6
^bb2: // pred: ^bb1
- %91 = llvm.constant(0 : index) : !llvm.i64
- %92 = llvm.constant(2 : index) : !llvm.i64
+ %91 = llvm.mlir.constant(0 : index) : !llvm.i64
+ %92 = llvm.mlir.constant(2 : index) : !llvm.i64
llvm.br ^bb3(%91 : !llvm.i64)
^bb3(%93: !llvm.i64): // 2 preds: ^bb2, ^bb4
%94 = llvm.icmp "slt" %93, %92 : !llvm.i64
llvm.cond_br %94, ^bb4, ^bb5
^bb4: // pred: ^bb3
- %95 = llvm.constant(2 : index) : !llvm.i64
- %96 = llvm.constant(2 : index) : !llvm.i64
+ %95 = llvm.mlir.constant(2 : index) : !llvm.i64
+ %96 = llvm.mlir.constant(2 : index) : !llvm.i64
%97 = llvm.mul %89, %96 : !llvm.i64
%98 = llvm.add %97, %93 : !llvm.i64
%99 = llvm.getelementptr %6[%98] : (!llvm<"double*">, !llvm.i64) -> !llvm<"double*">
%100 = llvm.load %99 : !llvm<"double*">
%101 = llvm.call @printf(%48, %100) : (!llvm<"i8*">, !llvm.double) -> !llvm.i32
- %102 = llvm.constant(1 : index) : !llvm.i64
+ %102 = llvm.mlir.constant(1 : index) : !llvm.i64
%103 = llvm.add %93, %102 : !llvm.i64
llvm.br ^bb3(%103 : !llvm.i64)
^bb5: // pred: ^bb3
%104 = llvm.call @printf(%76, %71) : (!llvm<"i8*">, !llvm.double) -> !llvm.i32
- %105 = llvm.constant(1 : index) : !llvm.i64
+ %105 = llvm.mlir.constant(1 : index) : !llvm.i64
%106 = llvm.add %89, %105 : !llvm.i64
llvm.br ^bb1(%106 : !llvm.i64)
```
let printer = [{ *p << getOperationName(); }];
}
-// Pseudo-operations (do not appear in LLVM IR but necessary for the dialect to
-// work correctly).
+// Auxiliary operations (do not appear in LLVM IR but necessary for the dialect
+// to work correctly).
def LLVM_AddressOfOp
- : LLVM_OneResultOp<"addressof">,
+ : LLVM_OneResultOp<"mlir.addressof">,
Arguments<(ins SymbolRefAttr:$global_name)> {
let builders = [
OpBuilder<"Builder *builder, OperationState *result, LLVMType resType, "
];
let extraClassDeclaration = [{
- /// Return the llvm.global operation that defined the value referenced here.
+ /// Return the llvm.mlir.global operation that defined the value referenced
+ /// here.
GlobalOp getGlobal();
}];
}
def LLVM_GlobalOp
- : LLVM_ZeroResultOp<"global">,
+ : LLVM_ZeroResultOp<"mlir.global">,
Arguments<(ins TypeAttr:$type, UnitAttr:$constant, StrAttr:$sym_name,
AnyAttr:$value)> {
}];
}
-def LLVM_UndefOp : LLVM_OneResultOp<"undef", [NoSideEffect]>,
+def LLVM_UndefOp : LLVM_OneResultOp<"mlir.undef", [NoSideEffect]>,
LLVM_Builder<"$res = llvm::UndefValue::get($_resultType);"> {
let parser = [{ return parseUndefOp(parser, result); }];
let printer = [{ printUndefOp(p, *this); }];
}
def LLVM_ConstantOp
- : LLVM_OneResultOp<"constant", [NoSideEffect]>,
+ : LLVM_OneResultOp<"mlir.constant", [NoSideEffect]>,
Arguments<(ins AnyAttr:$value)>,
LLVM_Builder<"$res = getLLVMConstant($_resultType, $value, $_location);">
{
ModuleOp mlirModule;
std::unique_ptr<llvm::Module> llvmModule;
- // Mappings between llvm.global definitions and corresponding globals.
+ // Mappings between llvm.mlir.global definitions and corresponding globals.
llvm::DenseMap<Operation *, llvm::GlobalValue *> globalsMapping;
protected:
*p << " : " << op.res()->getType();
}
-// <operation> ::= `llvm.undef` attribute-dict? : type
+// <operation> ::= `llvm.mlir.undef` attribute-dict? : type
static ParseResult parseUndefOp(OpAsmParser *parser, OperationState *result) {
Type type;
static LogicalResult verify(AddressOfOp op) {
auto global = op.getGlobal();
if (!global)
- return op.emitOpError("must reference a global defined by 'llvm.global'");
+ return op.emitOpError(
+ "must reference a global defined by 'llvm.mlir.global'");
if (global.getType().getPointerTo() != op.getResult()->getType())
return op.emitOpError(
*p << " : " << op.res()->getType();
}
-// <operation> ::= `llvm.constant` `(` attribute `)` attribute-list? : type
+// <operation> ::= `llvm.mlir.constant` `(` attribute `)` attribute-list? : type
static ParseResult parseConstantOp(OpAsmParser *parser,
OperationState *result) {
Attribute valueAttr;
p->printType(op.type());
}
-// <operation> ::= `llvm.global` `constant`? `@` identifier `(` attribute `)`
-// attribute-list? (`:` type)?
+// <operation> ::= `llvm.mlir.global` `constant`? `@` identifier
+// `(` attribute `)` attribute-list? (`:` type)?
//
// The type can be omitted for string attributes, in which case it will be
// inferred from the value of the string as [strlen(value) x i8].
return success();
}
-// Create named global variables that correspond to llvm.global definitions.
+// Create named global variables that correspond to llvm.mlir.global
+// definitions.
void ModuleTranslation::convertGlobals() {
for (auto op : mlirModule.getOps<LLVM::GlobalOp>()) {
llvm::Constant *cst;
// RUN: mlir-opt %s --generate-cubin-accessors | FileCheck %s
-// CHECK: llvm.global constant @[[global:.*]]("CUBIN")
+// CHECK: llvm.mlir.global constant @[[global:.*]]("CUBIN")
func @kernel(!llvm.float, !llvm<"float*">)
// CHECK: attributes {gpu.kernel, nvvm.cubin = "CUBIN", nvvm.cubingetter = @[[getter:.*]]}
attributes {gpu.kernel, nvvm.cubin = "CUBIN"}
// CHECK: func @[[getter]]() -> !llvm<"i8*">
-// CHECK: %[[addressof:.*]] = llvm.addressof @[[global]]
-// CHECK: %[[c0:.*]] = llvm.constant(0 : index)
+// CHECK: %[[addressof:.*]] = llvm.mlir.addressof @[[global]]
+// CHECK: %[[c0:.*]] = llvm.mlir.constant(0 : index)
// CHECK: %[[gep:.*]] = llvm.getelementptr %[[addressof]][%[[c0]], %[[c0]]]
// CHECK-SAME: -> !llvm<"i8*">
// CHECK: llvm.return %[[gep]] : !llvm<"i8*">
// RUN: mlir-opt %s --launch-func-to-cuda | FileCheck %s
-// CHECK: llvm.global constant @[[kernel_name:.*]]("kernel\00")
+// CHECK: llvm.mlir.global constant @[[kernel_name:.*]]("kernel\00")
func @cubin_getter() -> !llvm<"i8*">
return %2 : vector<2x3xf32>
}
// CHECK-LABEL: outerproduct
-// CHECK: llvm.undef : !llvm<"[2 x <3 x float>]">
+// CHECK: llvm.mlir.undef : !llvm<"[2 x <3 x float>]">
// CHECK: llvm.shufflevector {{.*}} [0 : i32, 0 : i32, 0 : i32] : !llvm<"<2 x float>">, !llvm<"<2 x float>">
// CHECK: llvm.fmul {{.*}}, {{.*}} : !llvm<"<3 x float>">
// CHECK: llvm.insertvalue {{.*}}[0] : !llvm<"[2 x <3 x float>]">
return %2 : vector<2x3xf32>
}
// CHECK-LABEL: outerproduct_add
-// CHECK: llvm.undef : !llvm<"[2 x <3 x float>]">
+// CHECK: llvm.mlir.undef : !llvm<"[2 x <3 x float>]">
// CHECK: llvm.shufflevector {{.*}} [0 : i32, 0 : i32, 0 : i32] : !llvm<"<2 x float>">, !llvm<"<2 x float>">
// CHECK: llvm.extractvalue {{.*}}[0] : !llvm<"[2 x <3 x float>]">
// CHECK: "llvm.intr.fmuladd"({{.*}}) : (!llvm<"<3 x float>">, !llvm<"<3 x float>">, !llvm<"<3 x float>">) -> !llvm<"<3 x float>">
}
// CHECK-LABEL: extract_element_from_vec_3d
// CHECK: llvm.extractvalue %{{.*}}[0 : i32, 0 : i32] : !llvm<"[4 x [3 x <16 x float>]]">
-// CHECK: llvm.constant(0 : i32) : !llvm.i32
+// CHECK: llvm.mlir.constant(0 : i32) : !llvm.i32
// CHECK: llvm.extractelement %{{.*}}, %{{.*}} : !llvm<"<16 x float>">
// CHECK: llvm.return %{{.*}} : !llvm.float
\ No newline at end of file
return
}
// LLVM-LABEL: @rangeConversion
-// LLVM-NEXT: %0 = llvm.undef : !llvm<"{ i64, i64, i64 }">
+// LLVM-NEXT: %0 = llvm.mlir.undef : !llvm<"{ i64, i64, i64 }">
// LLVM-NEXT: %1 = llvm.insertvalue %arg0, %0[0] : !llvm<"{ i64, i64, i64 }">
// LLVM-NEXT: %2 = llvm.insertvalue %arg1, %1[1] : !llvm<"{ i64, i64, i64 }">
// LLVM-NEXT: %3 = llvm.insertvalue %arg2, %2[2] : !llvm<"{ i64, i64, i64 }">
return
}
// LLVM-LABEL: @viewRangeConversion
-// LLVM-NEXT: %0 = llvm.undef : !llvm<"{ float*, i64, [2 x i64], [2 x i64] }">
+// LLVM-NEXT: %0 = llvm.mlir.undef : !llvm<"{ float*, i64, [2 x i64], [2 x i64] }">
// LLVM-NEXT: %1 = llvm.extractvalue %arg0[0] : !llvm<"{ float*, i64, i64 }">
// LLVM-NEXT: %2 = llvm.insertvalue %1, %0[0] : !llvm<"{ float*, i64, [2 x i64], [2 x i64] }">
// LLVM-NEXT: %3 = llvm.extractvalue %arg0[2] : !llvm<"{ float*, i64, i64 }">
-// LLVM-NEXT: %4 = llvm.constant(1 : index) : !llvm.i64
+// LLVM-NEXT: %4 = llvm.mlir.constant(1 : index) : !llvm.i64
// LLVM-NEXT: %5 = llvm.mul %4, %3 : !llvm.i64
-// LLVM-NEXT: %6 = llvm.constant(0 : index) : !llvm.i64
+// LLVM-NEXT: %6 = llvm.mlir.constant(0 : index) : !llvm.i64
// LLVM-NEXT: %7 = llvm.extractvalue %arg1[0] : !llvm<"{ i64, i64, i64 }">
// LLVM-NEXT: %8 = llvm.mul %7, %5 : !llvm.i64
// LLVM-NEXT: %9 = llvm.add %6, %8 : !llvm.i64
return
}
// LLVM-LABEL: @viewNonRangeConversion
-// LLVM-NEXT: %0 = llvm.undef : !llvm<"{ float*, i64, [1 x i64], [1 x i64] }">
+// LLVM-NEXT: %0 = llvm.mlir.undef : !llvm<"{ float*, i64, [1 x i64], [1 x i64] }">
// LLVM-NEXT: %1 = llvm.extractvalue %arg0[0] : !llvm<"{ float*, i64, i64 }">
// LLVM-NEXT: %2 = llvm.insertvalue %1, %0[0] : !llvm<"{ float*, i64, [1 x i64], [1 x i64] }">
// LLVM-NEXT: %3 = llvm.extractvalue %arg0[2] : !llvm<"{ float*, i64, i64 }">
-// LLVM-NEXT: %4 = llvm.constant(1 : index) : !llvm.i64
+// LLVM-NEXT: %4 = llvm.mlir.constant(1 : index) : !llvm.i64
// LLVM-NEXT: %5 = llvm.mul %4, %3 : !llvm.i64
-// LLVM-NEXT: %6 = llvm.constant(0 : index) : !llvm.i64
+// LLVM-NEXT: %6 = llvm.mlir.constant(0 : index) : !llvm.i64
// LLVM-NEXT: %7 = llvm.extractvalue %arg1[0] : !llvm<"{ i64, i64, i64 }">
// LLVM-NEXT: %8 = llvm.mul %7, %5 : !llvm.i64
// LLVM-NEXT: %9 = llvm.add %6, %8 : !llvm.i64
return
}
// LLVM-LABEL: @sliceRangeConversion
-// LLVM: %28 = llvm.undef : !llvm<"{ float*, i64, [2 x i64], [2 x i64] }">
+// LLVM: %28 = llvm.mlir.undef : !llvm<"{ float*, i64, [2 x i64], [2 x i64] }">
// LLVM-NEXT: %29 = llvm.extractvalue %27[0] : !llvm<"{ float*, i64, [2 x i64], [2 x i64] }">
// LLVM-NEXT: %30 = llvm.insertvalue %29, %28[0] : !llvm<"{ float*, i64, [2 x i64], [2 x i64] }">
// LLVM-NEXT: %31 = llvm.extractvalue %27[1] : !llvm<"{ float*, i64, [2 x i64], [2 x i64] }">
return
}
// LLVM-LABEL: @sliceNonRangeConversion2
-// LLVM: %28 = llvm.undef : !llvm<"{ float*, i64, [1 x i64], [1 x i64] }">
+// LLVM: %28 = llvm.mlir.undef : !llvm<"{ float*, i64, [1 x i64], [1 x i64] }">
// LLVM-NEXT: %29 = llvm.extractvalue %27[0] : !llvm<"{ float*, i64, [2 x i64], [2 x i64] }">
// LLVM-NEXT: %30 = llvm.insertvalue %29, %28[0] : !llvm<"{ float*, i64, [1 x i64], [1 x i64] }">
// LLVM-NEXT: %31 = llvm.extractvalue %27[1] : !llvm<"{ float*, i64, [2 x i64], [2 x i64] }">
// CHECK-LABEL: func @indirect_const_call(%arg0: !llvm.i32) {
func @indirect_const_call(%arg0: i32) {
-// CHECK-NEXT: %0 = llvm.constant(@body) : !llvm<"void (i32)*">
+// CHECK-NEXT: %0 = llvm.mlir.constant(@body) : !llvm<"void (i32)*">
%0 = constant @body : (i32) -> ()
// CHECK-NEXT: llvm.call %0(%arg0) : (!llvm.i32) -> ()
call_indirect %0(%arg0) : (i32) -> ()
// CHECK-LABEL: func @zero_d_alloc() -> !llvm<"float*"> {
func @zero_d_alloc() -> memref<f32> {
-// CHECK-NEXT: %0 = llvm.constant(1 : index) : !llvm.i64
-// CHECK-NEXT: %1 = llvm.constant(4 : index) : !llvm.i64
+// CHECK-NEXT: %0 = llvm.mlir.constant(1 : index) : !llvm.i64
+// CHECK-NEXT: %1 = llvm.mlir.constant(4 : index) : !llvm.i64
// CHECK-NEXT: %2 = llvm.mul %0, %1 : !llvm.i64
// CHECK-NEXT: %3 = llvm.call @malloc(%2) : (!llvm.i64) -> !llvm<"i8*">
// CHECK-NEXT: %4 = llvm.bitcast %3 : !llvm<"i8*"> to !llvm<"float*">
// CHECK-LABEL: func @mixed_alloc(%arg0: !llvm.i64, %arg1: !llvm.i64) -> !llvm<"{ float*, i64, i64 }"> {
func @mixed_alloc(%arg0: index, %arg1: index) -> memref<?x42x?xf32> {
-// CHECK-NEXT: %0 = llvm.constant(42 : index) : !llvm.i64
+// CHECK-NEXT: %0 = llvm.mlir.constant(42 : index) : !llvm.i64
// CHECK-NEXT: %1 = llvm.mul %arg0, %0 : !llvm.i64
// CHECK-NEXT: %2 = llvm.mul %1, %arg1 : !llvm.i64
-// CHECK-NEXT: %3 = llvm.constant(4 : index) : !llvm.i64
+// CHECK-NEXT: %3 = llvm.mlir.constant(4 : index) : !llvm.i64
// CHECK-NEXT: %4 = llvm.mul %2, %3 : !llvm.i64
// CHECK-NEXT: %5 = llvm.call @malloc(%4) : (!llvm.i64) -> !llvm<"i8*">
// CHECK-NEXT: %6 = llvm.bitcast %5 : !llvm<"i8*"> to !llvm<"float*">
-// CHECK-NEXT: %7 = llvm.undef : !llvm<"{ float*, i64, i64 }">
+// CHECK-NEXT: %7 = llvm.mlir.undef : !llvm<"{ float*, i64, i64 }">
// CHECK-NEXT: %8 = llvm.insertvalue %6, %7[0 : index] : !llvm<"{ float*, i64, i64 }">
// CHECK-NEXT: %9 = llvm.insertvalue %arg0, %8[1 : index] : !llvm<"{ float*, i64, i64 }">
// CHECK-NEXT: %10 = llvm.insertvalue %arg1, %9[2 : index] : !llvm<"{ float*, i64, i64 }">
// CHECK-LABEL: func @dynamic_alloc(%arg0: !llvm.i64, %arg1: !llvm.i64) -> !llvm<"{ float*, i64, i64 }"> {
func @dynamic_alloc(%arg0: index, %arg1: index) -> memref<?x?xf32> {
// CHECK-NEXT: %0 = llvm.mul %arg0, %arg1 : !llvm.i64
-// CHECK-NEXT: %1 = llvm.constant(4 : index) : !llvm.i64
+// CHECK-NEXT: %1 = llvm.mlir.constant(4 : index) : !llvm.i64
// CHECK-NEXT: %2 = llvm.mul %0, %1 : !llvm.i64
// CHECK-NEXT: %3 = llvm.call @malloc(%2) : (!llvm.i64) -> !llvm<"i8*">
// CHECK-NEXT: %4 = llvm.bitcast %3 : !llvm<"i8*"> to !llvm<"float*">
-// CHECK-NEXT: %5 = llvm.undef : !llvm<"{ float*, i64, i64 }">
+// CHECK-NEXT: %5 = llvm.mlir.undef : !llvm<"{ float*, i64, i64 }">
// CHECK-NEXT: %6 = llvm.insertvalue %4, %5[0 : index] : !llvm<"{ float*, i64, i64 }">
// CHECK-NEXT: %7 = llvm.insertvalue %arg0, %6[1 : index] : !llvm<"{ float*, i64, i64 }">
// CHECK-NEXT: %8 = llvm.insertvalue %arg1, %7[2 : index] : !llvm<"{ float*, i64, i64 }">
// CHECK-LABEL: func @static_alloc() -> !llvm<"float*"> {
func @static_alloc() -> memref<32x18xf32> {
-// CHECK-NEXT: %0 = llvm.constant(32 : index) : !llvm.i64
-// CHECK-NEXT: %1 = llvm.constant(18 : index) : !llvm.i64
+// CHECK-NEXT: %0 = llvm.mlir.constant(32 : index) : !llvm.i64
+// CHECK-NEXT: %1 = llvm.mlir.constant(18 : index) : !llvm.i64
// CHECK-NEXT: %2 = llvm.mul %0, %1 : !llvm.i64
-// CHECK-NEXT: %3 = llvm.constant(4 : index) : !llvm.i64
+// CHECK-NEXT: %3 = llvm.mlir.constant(4 : index) : !llvm.i64
// CHECK-NEXT: %4 = llvm.mul %2, %3 : !llvm.i64
// CHECK-NEXT: %5 = llvm.call @malloc(%4) : (!llvm.i64) -> !llvm<"i8*">
// CHECK-NEXT: %6 = llvm.bitcast %5 : !llvm<"i8*"> to !llvm<"float*">
// CHECK-LABEL: func @static_load
func @static_load(%static : memref<10x42xf32>, %i : index, %j : index) {
-// CHECK-NEXT: %0 = llvm.constant(10 : index) : !llvm.i64
-// CHECK-NEXT: %1 = llvm.constant(42 : index) : !llvm.i64
+// CHECK-NEXT: %0 = llvm.mlir.constant(10 : index) : !llvm.i64
+// CHECK-NEXT: %1 = llvm.mlir.constant(42 : index) : !llvm.i64
// CHECK-NEXT: %2 = llvm.mul %arg1, %1 : !llvm.i64
// CHECK-NEXT: %3 = llvm.add %2, %arg2 : !llvm.i64
// CHECK-NEXT: %4 = llvm.getelementptr %arg0[%3] : (!llvm<"float*">, !llvm.i64) -> !llvm<"float*">
// CHECK-LABEL: func @mixed_load
func @mixed_load(%mixed : memref<42x?xf32>, %i : index, %j : index) {
-// CHECK-NEXT: %0 = llvm.constant(42 : index) : !llvm.i64
+// CHECK-NEXT: %0 = llvm.mlir.constant(42 : index) : !llvm.i64
// CHECK-NEXT: %1 = llvm.extractvalue %arg0[1 : index] : !llvm<"{ float*, i64 }">
// CHECK-NEXT: %2 = llvm.mul %arg1, %1 : !llvm.i64
// CHECK-NEXT: %3 = llvm.add %2, %arg2 : !llvm.i64
// CHECK-LABEL: func @static_store
func @static_store(%static : memref<10x42xf32>, %i : index, %j : index, %val : f32) {
-// CHECK-NEXT: %0 = llvm.constant(10 : index) : !llvm.i64
-// CHECK-NEXT: %1 = llvm.constant(42 : index) : !llvm.i64
+// CHECK-NEXT: %0 = llvm.mlir.constant(10 : index) : !llvm.i64
+// CHECK-NEXT: %1 = llvm.mlir.constant(42 : index) : !llvm.i64
// CHECK-NEXT: %2 = llvm.mul %arg1, %1 : !llvm.i64
// CHECK-NEXT: %3 = llvm.add %2, %arg2 : !llvm.i64
// CHECK-NEXT: %4 = llvm.getelementptr %arg0[%3] : (!llvm<"float*">, !llvm.i64) -> !llvm<"float*">
// CHECK-LABEL: func @mixed_store
func @mixed_store(%mixed : memref<42x?xf32>, %i : index, %j : index, %val : f32) {
-// CHECK-NEXT: %0 = llvm.constant(42 : index) : !llvm.i64
+// CHECK-NEXT: %0 = llvm.mlir.constant(42 : index) : !llvm.i64
// CHECK-NEXT: %1 = llvm.extractvalue %arg0[1 : index] : !llvm<"{ float*, i64 }">
// CHECK-NEXT: %2 = llvm.mul %arg1, %1 : !llvm.i64
// CHECK-NEXT: %3 = llvm.add %2, %arg2 : !llvm.i64
// CHECK-LABEL: func @memref_cast_static_to_dynamic
func @memref_cast_static_to_dynamic(%static : memref<10x42xf32>) {
-// CHECK-NEXT: %0 = llvm.undef : !llvm<"{ float*, i64, i64 }">
+// CHECK-NEXT: %0 = llvm.mlir.undef : !llvm<"{ float*, i64, i64 }">
// CHECK-NEXT: %1 = llvm.insertvalue %arg0, %0[0 : index] : !llvm<"{ float*, i64, i64 }">
-// CHECK-NEXT: %2 = llvm.constant(10 : index) : !llvm.i64
+// CHECK-NEXT: %2 = llvm.mlir.constant(10 : index) : !llvm.i64
// CHECK-NEXT: %3 = llvm.insertvalue %2, %1[1 : index] : !llvm<"{ float*, i64, i64 }">
-// CHECK-NEXT: %4 = llvm.constant(42 : index) : !llvm.i64
+// CHECK-NEXT: %4 = llvm.mlir.constant(42 : index) : !llvm.i64
// CHECK-NEXT: %5 = llvm.insertvalue %4, %3[2 : index] : !llvm<"{ float*, i64, i64 }">
%0 = memref_cast %static : memref<10x42xf32> to memref<?x?xf32>
return
// CHECK-LABEL: func @memref_cast_static_to_mixed
func @memref_cast_static_to_mixed(%static : memref<10x42xf32>) {
-// CHECK-NEXT: %0 = llvm.undef : !llvm<"{ float*, i64 }">
+// CHECK-NEXT: %0 = llvm.mlir.undef : !llvm<"{ float*, i64 }">
// CHECK-NEXT: %1 = llvm.insertvalue %arg0, %0[0 : index] : !llvm<"{ float*, i64 }">
-// CHECK-NEXT: %2 = llvm.constant(10 : index) : !llvm.i64
+// CHECK-NEXT: %2 = llvm.mlir.constant(10 : index) : !llvm.i64
// CHECK-NEXT: %3 = llvm.insertvalue %2, %1[1 : index] : !llvm<"{ float*, i64 }">
%0 = memref_cast %static : memref<10x42xf32> to memref<?x42xf32>
return
// CHECK-LABEL: func @memref_cast_dynamic_to_mixed
func @memref_cast_dynamic_to_mixed(%dynamic : memref<?x?xf32>) {
// CHECK-NEXT: %0 = llvm.extractvalue %arg0[0 : index] : !llvm<"{ float*, i64, i64 }">
-// CHECK-NEXT: %1 = llvm.undef : !llvm<"{ float*, i64 }">
+// CHECK-NEXT: %1 = llvm.mlir.undef : !llvm<"{ float*, i64 }">
// CHECK-NEXT: %2 = llvm.insertvalue %0, %1[0 : index] : !llvm<"{ float*, i64 }">
// CHECK-NEXT: %3 = llvm.extractvalue %arg0[1 : index] : !llvm<"{ float*, i64, i64 }">
// CHECK-NEXT: %4 = llvm.insertvalue %3, %2[1 : index] : !llvm<"{ float*, i64 }">
// CHECK-LABEL: func @memref_cast_mixed_to_dynamic
func @memref_cast_mixed_to_dynamic(%mixed : memref<42x?xf32>) {
// CHECK-NEXT: %0 = llvm.extractvalue %arg0[0 : index] : !llvm<"{ float*, i64 }">
-// CHECK-NEXT: %1 = llvm.undef : !llvm<"{ float*, i64, i64 }">
+// CHECK-NEXT: %1 = llvm.mlir.undef : !llvm<"{ float*, i64, i64 }">
// CHECK-NEXT: %2 = llvm.insertvalue %0, %1[0 : index] : !llvm<"{ float*, i64, i64 }">
-// CHECK-NEXT: %3 = llvm.constant(42 : index) : !llvm.i64
+// CHECK-NEXT: %3 = llvm.mlir.constant(42 : index) : !llvm.i64
// CHECK-NEXT: %4 = llvm.insertvalue %3, %2[1 : index] : !llvm<"{ float*, i64, i64 }">
// CHECK-NEXT: %5 = llvm.extractvalue %arg0[1 : index] : !llvm<"{ float*, i64 }">
// CHECK-NEXT: %6 = llvm.insertvalue %5, %4[2 : index] : !llvm<"{ float*, i64, i64 }">
// CHECK-LABEL: func @memref_cast_mixed_to_mixed
func @memref_cast_mixed_to_mixed(%mixed : memref<42x?xf32>) {
// CHECK-NEXT: %0 = llvm.extractvalue %arg0[0 : index] : !llvm<"{ float*, i64 }">
-// CHECK-NEXT: %1 = llvm.undef : !llvm<"{ float*, i64 }">
+// CHECK-NEXT: %1 = llvm.mlir.undef : !llvm<"{ float*, i64 }">
// CHECK-NEXT: %2 = llvm.insertvalue %0, %1[0 : index] : !llvm<"{ float*, i64 }">
-// CHECK-NEXT: %3 = llvm.constant(42 : index) : !llvm.i64
+// CHECK-NEXT: %3 = llvm.mlir.constant(42 : index) : !llvm.i64
// CHECK-NEXT: %4 = llvm.insertvalue %3, %2[1 : index] : !llvm<"{ float*, i64 }">
%0 = memref_cast %mixed : memref<42x?xf32> to memref<?x1xf32>
return
// CHECK-LABEL: func @mixed_memref_dim(%arg0: !llvm<"{ float*, i64, i64, i64 }">)
func @mixed_memref_dim(%mixed : memref<42x?x?x13x?xf32>) {
-// CHECK-NEXT: %0 = llvm.constant(42 : index) : !llvm.i64
+// CHECK-NEXT: %0 = llvm.mlir.constant(42 : index) : !llvm.i64
%0 = dim %mixed, 0 : memref<42x?x?x13x?xf32>
// CHECK-NEXT: %1 = llvm.extractvalue %arg0[1 : index] : !llvm<"{ float*, i64, i64, i64 }">
%1 = dim %mixed, 1 : memref<42x?x?x13x?xf32>
// CHECK-NEXT: %2 = llvm.extractvalue %arg0[2 : index] : !llvm<"{ float*, i64, i64, i64 }">
%2 = dim %mixed, 2 : memref<42x?x?x13x?xf32>
-// CHECK-NEXT: %3 = llvm.constant(13 : index) : !llvm.i64
+// CHECK-NEXT: %3 = llvm.mlir.constant(13 : index) : !llvm.i64
%3 = dim %mixed, 3 : memref<42x?x?x13x?xf32>
// CHECK-NEXT: %4 = llvm.extractvalue %arg0[3 : index] : !llvm<"{ float*, i64, i64, i64 }">
%4 = dim %mixed, 4 : memref<42x?x?x13x?xf32>
// CHECK-LABEL: func @static_memref_dim(%arg0: !llvm<"float*">)
func @static_memref_dim(%static : memref<42x32x15x13x27xf32>) {
-// CHECK-NEXT: %0 = llvm.constant(42 : index) : !llvm.i64
+// CHECK-NEXT: %0 = llvm.mlir.constant(42 : index) : !llvm.i64
%0 = dim %static, 0 : memref<42x32x15x13x27xf32>
-// CHECK-NEXT: %1 = llvm.constant(32 : index) : !llvm.i64
+// CHECK-NEXT: %1 = llvm.mlir.constant(32 : index) : !llvm.i64
%1 = dim %static, 1 : memref<42x32x15x13x27xf32>
-// CHECK-NEXT: %2 = llvm.constant(15 : index) : !llvm.i64
+// CHECK-NEXT: %2 = llvm.mlir.constant(15 : index) : !llvm.i64
%2 = dim %static, 2 : memref<42x32x15x13x27xf32>
-// CHECK-NEXT: %3 = llvm.constant(13 : index) : !llvm.i64
+// CHECK-NEXT: %3 = llvm.mlir.constant(13 : index) : !llvm.i64
%3 = dim %static, 3 : memref<42x32x15x13x27xf32>
-// CHECK-NEXT: %4 = llvm.constant(27 : index) : !llvm.i64
+// CHECK-NEXT: %4 = llvm.mlir.constant(27 : index) : !llvm.i64
%4 = dim %static, 4 : memref<42x32x15x13x27xf32>
return
}
br ^bb1
// CHECK-NEXT: ^bb1: // pred: ^bb0
-// CHECK-NEXT: {{.*}} = llvm.constant(1 : index) : !llvm.i64
-// CHECK-NEXT: {{.*}} = llvm.constant(42 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(1 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(42 : index) : !llvm.i64
// CHECK-NEXT: llvm.br ^bb2({{.*}} : !llvm.i64)
^bb1: // pred: ^bb0
%c1 = constant 1 : index
// CHECK: ^bb3: // pred: ^bb2
// CHECK-NEXT: llvm.call @body({{.*}}) : (!llvm.i64) -> ()
-// CHECK-NEXT: {{.*}} = llvm.constant(1 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(1 : index) : !llvm.i64
// CHECK-NEXT: {{.*}} = llvm.add {{.*}}, {{.*}} : !llvm.i64
// CHECK-NEXT: llvm.br ^bb2({{.*}} : !llvm.i64)
^bb3: // pred: ^bb2
func @other(index, i32) -> i32
// CHECK-LABEL: func @func_args(%arg0: !llvm.i32, %arg1: !llvm.i32) -> !llvm.i32 {
-// CHECK-NEXT: {{.*}} = llvm.constant(0 : i32) : !llvm.i32
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(0 : i32) : !llvm.i32
// CHECK-NEXT: llvm.br ^bb1
func @func_args(i32, i32) -> i32 {
^bb0(%arg0: i32, %arg1: i32):
br ^bb1
// CHECK-NEXT: ^bb1: // pred: ^bb0
-// CHECK-NEXT: {{.*}} = llvm.constant(0 : index) : !llvm.i64
-// CHECK-NEXT: {{.*}} = llvm.constant(42 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(0 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(42 : index) : !llvm.i64
// CHECK-NEXT: llvm.br ^bb2({{.*}} : !llvm.i64)
^bb1: // pred: ^bb0
%c0 = constant 0 : index
// CHECK-NEXT: {{.*}} = llvm.call @other({{.*}}, %arg0) : (!llvm.i64, !llvm.i32) -> !llvm.i32
// CHECK-NEXT: {{.*}} = llvm.call @other({{.*}}, {{.*}}) : (!llvm.i64, !llvm.i32) -> !llvm.i32
// CHECK-NEXT: {{.*}} = llvm.call @other({{.*}}, %arg1) : (!llvm.i64, !llvm.i32) -> !llvm.i32
-// CHECK-NEXT: {{.*}} = llvm.constant(1 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(1 : index) : !llvm.i64
// CHECK-NEXT: {{.*}} = llvm.add {{.*}}, {{.*}} : !llvm.i64
// CHECK-NEXT: llvm.br ^bb2({{.*}} : !llvm.i64)
^bb3: // pred: ^bb2
br ^bb2(%6 : index)
// CHECK-NEXT: ^bb4: // pred: ^bb2
-// CHECK-NEXT: {{.*}} = llvm.constant(0 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(0 : index) : !llvm.i64
// CHECK-NEXT: {{.*}} = llvm.call @other({{.*}}, {{.*}}) : (!llvm.i64, !llvm.i32) -> !llvm.i32
// CHECK-NEXT: llvm.return {{.*}} : !llvm.i32
^bb4: // pred: ^bb2
br ^bb1
// CHECK-NEXT: ^bb1: // pred: ^bb0
-// CHECK-NEXT: {{.*}} = llvm.constant(0 : index) : !llvm.i64
-// CHECK-NEXT: {{.*}} = llvm.constant(42 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(0 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(42 : index) : !llvm.i64
// CHECK-NEXT: llvm.br ^bb2({{.*}} : !llvm.i64)
^bb1: // pred: ^bb0
%c0 = constant 0 : index
br ^bb4
// CHECK-NEXT: ^bb4: // pred: ^bb3
-// CHECK-NEXT: {{.*}} = llvm.constant(7 : index) : !llvm.i64
-// CHECK-NEXT: {{.*}} = llvm.constant(56 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(7 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(56 : index) : !llvm.i64
// CHECK-NEXT: llvm.br ^bb5({{.*}} : !llvm.i64)
^bb4: // pred: ^bb3
%c7 = constant 7 : index
// CHECK-NEXT: ^bb6: // pred: ^bb5
// CHECK-NEXT: llvm.call @body2({{.*}}, {{.*}}) : (!llvm.i64, !llvm.i64) -> ()
-// CHECK-NEXT: {{.*}} = llvm.constant(2 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(2 : index) : !llvm.i64
// CHECK-NEXT: {{.*}} = llvm.add {{.*}}, {{.*}} : !llvm.i64
// CHECK-NEXT: llvm.br ^bb5({{.*}} : !llvm.i64)
^bb6: // pred: ^bb5
// CHECK-NEXT: ^bb7: // pred: ^bb5
// CHECK-NEXT: llvm.call @post({{.*}}) : (!llvm.i64) -> ()
-// CHECK-NEXT: {{.*}} = llvm.constant(1 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(1 : index) : !llvm.i64
// CHECK-NEXT: {{.*}} = llvm.add {{.*}}, {{.*}} : !llvm.i64
// CHECK-NEXT: llvm.br ^bb2({{.*}} : !llvm.i64)
^bb7: // pred: ^bb5
// CHECK-LABEL: func @more_imperfectly_nested_loops() {
// CHECK-NEXT: llvm.br ^bb1
// CHECK-NEXT:^bb1: // pred: ^bb0
-// CHECK-NEXT: {{.*}} = llvm.constant(0 : index) : !llvm.i64
-// CHECK-NEXT: {{.*}} = llvm.constant(42 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(0 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(42 : index) : !llvm.i64
// CHECK-NEXT: llvm.br ^bb2({{.*}} : !llvm.i64)
// CHECK-NEXT:^bb2({{.*}}: !llvm.i64): // 2 preds: ^bb1, ^bb11
// CHECK-NEXT: {{.*}} = llvm.icmp "slt" {{.*}}, {{.*}} : !llvm.i64
// CHECK-NEXT: llvm.call @pre({{.*}}) : (!llvm.i64) -> ()
// CHECK-NEXT: llvm.br ^bb4
// CHECK-NEXT:^bb4: // pred: ^bb3
-// CHECK-NEXT: {{.*}} = llvm.constant(7 : index) : !llvm.i64
-// CHECK-NEXT: {{.*}} = llvm.constant(56 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(7 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(56 : index) : !llvm.i64
// CHECK-NEXT: llvm.br ^bb5({{.*}} : !llvm.i64)
// CHECK-NEXT:^bb5({{.*}}: !llvm.i64): // 2 preds: ^bb4, ^bb6
// CHECK-NEXT: {{.*}} = llvm.icmp "slt" {{.*}}, {{.*}} : !llvm.i64
// CHECK-NEXT: llvm.cond_br {{.*}}, ^bb6, ^bb7
// CHECK-NEXT:^bb6: // pred: ^bb5
// CHECK-NEXT: llvm.call @body2({{.*}}, {{.*}}) : (!llvm.i64, !llvm.i64) -> ()
-// CHECK-NEXT: {{.*}} = llvm.constant(2 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(2 : index) : !llvm.i64
// CHECK-NEXT: {{.*}} = llvm.add {{.*}}, {{.*}} : !llvm.i64
// CHECK-NEXT: llvm.br ^bb5({{.*}} : !llvm.i64)
// CHECK-NEXT:^bb7: // pred: ^bb5
// CHECK-NEXT: llvm.call @mid({{.*}}) : (!llvm.i64) -> ()
// CHECK-NEXT: llvm.br ^bb8
// CHECK-NEXT:^bb8: // pred: ^bb7
-// CHECK-NEXT: {{.*}} = llvm.constant(18 : index) : !llvm.i64
-// CHECK-NEXT: {{.*}} = llvm.constant(37 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(18 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(37 : index) : !llvm.i64
// CHECK-NEXT: llvm.br ^bb9({{.*}} : !llvm.i64)
// CHECK-NEXT:^bb9({{.*}}: !llvm.i64): // 2 preds: ^bb8, ^bb10
// CHECK-NEXT: {{.*}} = llvm.icmp "slt" {{.*}}, {{.*}} : !llvm.i64
// CHECK-NEXT: llvm.cond_br {{.*}}, ^bb10, ^bb11
// CHECK-NEXT:^bb10: // pred: ^bb9
// CHECK-NEXT: llvm.call @body3({{.*}}, {{.*}}) : (!llvm.i64, !llvm.i64) -> ()
-// CHECK-NEXT: {{.*}} = llvm.constant(3 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(3 : index) : !llvm.i64
// CHECK-NEXT: {{.*}} = llvm.add {{.*}}, {{.*}} : !llvm.i64
// CHECK-NEXT: llvm.br ^bb9({{.*}} : !llvm.i64)
// CHECK-NEXT:^bb11: // pred: ^bb9
// CHECK-NEXT: llvm.call @post({{.*}}) : (!llvm.i64) -> ()
-// CHECK-NEXT: {{.*}} = llvm.constant(1 : index) : !llvm.i64
+// CHECK-NEXT: {{.*}} = llvm.mlir.constant(1 : index) : !llvm.i64
// CHECK-NEXT: {{.*}} = llvm.add {{.*}}, {{.*}} : !llvm.i64
// CHECK-NEXT: llvm.br ^bb2({{.*}} : !llvm.i64)
// CHECK-NEXT:^bb12: // pred: ^bb2
%0 = call @get_i64() : () -> (i64)
%1 = call @get_f32() : () -> (f32)
%2 = call @get_memref() : () -> (memref<42x?x10x?xf32>)
-// CHECK-NEXT: {{.*}} = llvm.undef : !llvm<"{ i64, float, { float*, i64, i64 } }">
+// CHECK-NEXT: {{.*}} = llvm.mlir.undef : !llvm<"{ i64, float, { float*, i64, i64 } }">
// CHECK-NEXT: {{.*}} = llvm.insertvalue {{.*}}, {{.*}}[0 : index] : !llvm<"{ i64, float, { float*, i64, i64 } }">
// CHECK-NEXT: {{.*}} = llvm.insertvalue {{.*}}, {{.*}}[1 : index] : !llvm<"{ i64, float, { float*, i64, i64 } }">
// CHECK-NEXT: {{.*}} = llvm.insertvalue {{.*}}, {{.*}}[2 : index] : !llvm<"{ i64, float, { float*, i64, i64 } }">
// CHECK-LABEL: func @vector_ops(%arg0: !llvm<"<4 x float>">, %arg1: !llvm<"<4 x i1>">, %arg2: !llvm<"<4 x i64>">) -> !llvm<"<4 x float>"> {
func @vector_ops(vector<4xf32>, vector<4xi1>, vector<4xi64>) -> vector<4xf32> {
^bb0(%arg0: vector<4xf32>, %arg1: vector<4xi1>, %arg2: vector<4xi64>):
-// CHECK-NEXT: %0 = llvm.constant(dense<4.200000e+01> : vector<4xf32>) : !llvm<"<4 x float>">
+// CHECK-NEXT: %0 = llvm.mlir.constant(dense<4.200000e+01> : vector<4xf32>) : !llvm<"<4 x float>">
%0 = constant dense<42.> : vector<4xf32>
// CHECK-NEXT: %1 = llvm.fadd %arg0, %0 : !llvm<"<4 x float>">
%1 = addf %arg0, %0 : vector<4xf32>
// CHECK-LABEL: @dfs_block_order
func @dfs_block_order() -> (i32) {
-// CHECK-NEXT: %0 = llvm.constant(42 : i32) : !llvm.i32
+// CHECK-NEXT: %0 = llvm.mlir.constant(42 : i32) : !llvm.i32
%0 = constant 42 : i32
// CHECK-NEXT: llvm.br ^bb2
br ^bb2
// CHECK-NEXT: ^bb2:
^bb2:
-// CHECK-NEXT: %2 = llvm.constant(55 : i32) : !llvm.i32
+// CHECK-NEXT: %2 = llvm.mlir.constant(55 : i32) : !llvm.i32
%1 = constant 55 : i32
// CHECK-NEXT: llvm.br ^bb1
br ^bb1
%0 = addf %arg0, %arg0 : vector<2x2x2xf32>
return %0 : vector<2x2x2xf32>
-// CHECK-NEXT: llvm.undef : !llvm<"[2 x [2 x <2 x float>]]">
+// CHECK-NEXT: llvm.mlir.undef : !llvm<"[2 x [2 x <2 x float>]]">
// This block appears 2x2 times
// CHECK-NEXT: llvm.extractvalue %{{.*}}[0 : index, 0 : index] : !llvm<"[2 x [2 x <2 x float>]]">
// RUN: mlir-opt -split-input-file -verify-diagnostics %s | FileCheck %s
-// CHECK: llvm.global @global(42 : i64) : !llvm.i64
-llvm.global @global(42 : i64) : !llvm.i64
+// CHECK: llvm.mlir.global @global(42 : i64) : !llvm.i64
+llvm.mlir.global @global(42 : i64) : !llvm.i64
-// CHECK: llvm.global constant @constant(3.700000e+01 : f64) : !llvm.float
-llvm.global constant @constant(37.0) : !llvm.float
+// CHECK: llvm.mlir.global constant @constant(3.700000e+01 : f64) : !llvm.float
+llvm.mlir.global constant @constant(37.0) : !llvm.float
-// CHECK: llvm.global constant @string("foobar")
-llvm.global constant @string("foobar") : !llvm<"[6 x i8]">
+// CHECK: llvm.mlir.global constant @string("foobar")
+llvm.mlir.global constant @string("foobar") : !llvm<"[6 x i8]">
-// CHECK: llvm.global @string_notype("1234567")
-llvm.global @string_notype("1234567")
+// CHECK: llvm.mlir.global @string_notype("1234567")
+llvm.mlir.global @string_notype("1234567")
// CHECK-LABEL: references
func @references() {
- // CHECK: llvm.addressof @global : !llvm<"i64*">
- %0 = llvm.addressof @global : !llvm<"i64*">
+ // CHECK: llvm.mlir.addressof @global : !llvm<"i64*">
+ %0 = llvm.mlir.addressof @global : !llvm<"i64*">
- // CHECK: llvm.addressof @string : !llvm<"[6 x i8]*">
- %1 = llvm.addressof @string : !llvm<"[6 x i8]*">
+ // CHECK: llvm.mlir.addressof @string : !llvm<"[6 x i8]*">
+ %1 = llvm.mlir.addressof @string : !llvm<"[6 x i8]*">
llvm.return
}
// -----
// expected-error @+1 {{op requires attribute 'sym_name'}}
-"llvm.global"() {type = !llvm.i64, constant, value = 42 : i64} : () -> ()
+"llvm.mlir.global"() {type = !llvm.i64, constant, value = 42 : i64} : () -> ()
// -----
// expected-error @+1 {{op requires attribute 'type'}}
-"llvm.global"() {sym_name = "foo", constant, value = 42 : i64} : () -> ()
+"llvm.mlir.global"() {sym_name = "foo", constant, value = 42 : i64} : () -> ()
// -----
// expected-error @+1 {{op requires attribute 'value'}}
-"llvm.global"() {sym_name = "foo", type = !llvm.i64, constant} : () -> ()
+"llvm.mlir.global"() {sym_name = "foo", type = !llvm.i64, constant} : () -> ()
// -----
// expected-error @+1 {{expects type to be a valid element type for an LLVM pointer}}
-llvm.global constant @constant(37.0) : !llvm<"label">
+llvm.mlir.global constant @constant(37.0) : !llvm<"label">
// -----
func @foo() {
// expected-error @+1 {{must appear at the module level}}
- llvm.global @bar(42) : !llvm.i32
+ llvm.mlir.global @bar(42) : !llvm.i32
}
// -----
// expected-error @+1 {{requires an i8 array type of the length equal to that of the string}}
-llvm.global constant @string("foobar") : !llvm<"[42 x i8]">
+llvm.mlir.global constant @string("foobar") : !llvm<"[42 x i8]">
// -----
// expected-error @+1 {{type can only be omitted for string globals}}
-llvm.global @i64_needs_type(0: i64)
+llvm.mlir.global @i64_needs_type(0: i64)
// -----
// expected-error @+1 {{expected zero or one type}}
-llvm.global @more_than_one_type(0) : !llvm.i64, !llvm.i32
+llvm.mlir.global @more_than_one_type(0) : !llvm.i64, !llvm.i32
// -----
-llvm.global @foo(0: i32) : !llvm.i32
+llvm.mlir.global @foo(0: i32) : !llvm.i32
func @bar() {
// expected-error @+2{{expected ':'}}
- llvm.addressof @foo
+ llvm.mlir.addressof @foo
}
// -----
// The attribute parser will consume the first colon-type, so we put two of
// them to trigger the attribute type mismatch error.
// expected-error @+1 {{expected symbol reference}}
- llvm.addressof "foo" : i64 : !llvm<"void ()*">
+ llvm.mlir.addressof "foo" : i64 : !llvm<"void ()*">
}
// -----
func @foo() {
- // expected-error @+1 {{must reference a global defined by 'llvm.global'}}
- llvm.addressof @foo : !llvm<"void ()*">
+ // expected-error @+1 {{must reference a global defined by 'llvm.mlir.global'}}
+ llvm.mlir.addressof @foo : !llvm<"void ()*">
}
// -----
-llvm.global @foo(0: i32) : !llvm.i32
+llvm.mlir.global @foo(0: i32) : !llvm.i32
func @bar() {
// expected-error @+1 {{the type must be a pointer to the type of the referred global}}
- llvm.addressof @foo : !llvm<"i64*">
+ llvm.mlir.addressof @foo : !llvm<"i64*">
}
// CHECK-NEXT: %17 = llvm.call @foo(%arg0) : (!llvm.i32) -> !llvm<"{ i32, double, i32 }">
// CHECK-NEXT: %18 = llvm.extractvalue %17[0] : !llvm<"{ i32, double, i32 }">
// CHECK-NEXT: %19 = llvm.insertvalue %18, %17[2] : !llvm<"{ i32, double, i32 }">
-// CHECK-NEXT: %20 = llvm.constant(@foo) : !llvm<"{ i32, double, i32 } (i32)*">
+// CHECK-NEXT: %20 = llvm.mlir.constant(@foo) : !llvm<"{ i32, double, i32 } (i32)*">
// CHECK-NEXT: %21 = llvm.call %20(%arg0) : (!llvm.i32) -> !llvm<"{ i32, double, i32 }">
%17 = llvm.call @foo(%arg0) : (!llvm.i32) -> !llvm<"{ i32, double, i32 }">
%18 = llvm.extractvalue %17[0] : !llvm<"{ i32, double, i32 }">
%19 = llvm.insertvalue %18, %17[2] : !llvm<"{ i32, double, i32 }">
- %20 = llvm.constant(@foo) : !llvm<"{ i32, double, i32 } (i32)*">
+ %20 = llvm.mlir.constant(@foo) : !llvm<"{ i32, double, i32 } (i32)*">
%21 = llvm.call %20(%arg0) : (!llvm.i32) -> !llvm<"{ i32, double, i32 }">
llvm.cond_br %7, ^bb2, ^bb1
^bb2:
-// CHECK: %22 = llvm.undef : !llvm<"{ i32, double, i32 }">
-// CHECK-NEXT: %23 = llvm.constant(42 : i64) : !llvm.i47
- %22 = llvm.undef : !llvm<"{ i32, double, i32 }">
- %23 = llvm.constant(42) : !llvm.i47
+// CHECK: %22 = llvm.mlir.undef : !llvm<"{ i32, double, i32 }">
+// CHECK-NEXT: %23 = llvm.mlir.constant(42 : i64) : !llvm.i47
+ %22 = llvm.mlir.undef : !llvm<"{ i32, double, i32 }">
+ %23 = llvm.mlir.constant(42) : !llvm.i47
// Misc operations.
// CHECK: %24 = llvm.select %7, %0, %1 : !llvm.i1, !llvm.i32
// An larger self-contained function.
// CHECK-LABEL:func @foo(%arg0: !llvm.i32) -> !llvm<"{ i32, double, i32 }"> {
func @foo(%arg0: !llvm.i32) -> !llvm<"{ i32, double, i32 }"> {
-// CHECK-NEXT: %0 = llvm.constant(3 : i64) : !llvm.i32
-// CHECK-NEXT: %1 = llvm.constant(3 : i64) : !llvm.i32
-// CHECK-NEXT: %2 = llvm.constant(4.200000e+01 : f64) : !llvm.double
-// CHECK-NEXT: %3 = llvm.constant(4.200000e+01 : f64) : !llvm.double
+// CHECK-NEXT: %0 = llvm.mlir.constant(3 : i64) : !llvm.i32
+// CHECK-NEXT: %1 = llvm.mlir.constant(3 : i64) : !llvm.i32
+// CHECK-NEXT: %2 = llvm.mlir.constant(4.200000e+01 : f64) : !llvm.double
+// CHECK-NEXT: %3 = llvm.mlir.constant(4.200000e+01 : f64) : !llvm.double
// CHECK-NEXT: %4 = llvm.add %0, %1 : !llvm.i32
// CHECK-NEXT: %5 = llvm.mul %4, %1 : !llvm.i32
// CHECK-NEXT: %6 = llvm.fadd %2, %3 : !llvm.double
// CHECK-NEXT: %7 = llvm.fsub %3, %6 : !llvm.double
-// CHECK-NEXT: %8 = llvm.constant(1 : i64) : !llvm.i1
+// CHECK-NEXT: %8 = llvm.mlir.constant(1 : i64) : !llvm.i1
// CHECK-NEXT: llvm.cond_br %8, ^bb1(%4 : !llvm.i32), ^bb2(%4 : !llvm.i32)
- %0 = llvm.constant(3) : !llvm.i32
- %1 = llvm.constant(3) : !llvm.i32
- %2 = llvm.constant(4.200000e+01) : !llvm.double
- %3 = llvm.constant(4.200000e+01) : !llvm.double
+ %0 = llvm.mlir.constant(3) : !llvm.i32
+ %1 = llvm.mlir.constant(3) : !llvm.i32
+ %2 = llvm.mlir.constant(4.200000e+01) : !llvm.double
+ %3 = llvm.mlir.constant(4.200000e+01) : !llvm.double
%4 = llvm.add %0, %1 : !llvm.i32
%5 = llvm.mul %4, %1 : !llvm.i32
%6 = llvm.fadd %2, %3 : !llvm.double
%7 = llvm.fsub %3, %6 : !llvm.double
- %8 = llvm.constant(1) : !llvm.i1
+ %8 = llvm.mlir.constant(1) : !llvm.i1
llvm.cond_br %8, ^bb1(%4 : !llvm.i32), ^bb2(%4 : !llvm.i32)
// CHECK-NEXT:^bb1(%9: !llvm.i32):
// CHECK-NEXT: %11 = llvm.extractvalue %10[0] : !llvm<"{ i32, double, i32 }">
// CHECK-NEXT: %12 = llvm.extractvalue %10[1] : !llvm<"{ i32, double, i32 }">
// CHECK-NEXT: %13 = llvm.extractvalue %10[2] : !llvm<"{ i32, double, i32 }">
-// CHECK-NEXT: %14 = llvm.undef : !llvm<"{ i32, double, i32 }">
+// CHECK-NEXT: %14 = llvm.mlir.undef : !llvm<"{ i32, double, i32 }">
// CHECK-NEXT: %15 = llvm.insertvalue %5, %14[0] : !llvm<"{ i32, double, i32 }">
// CHECK-NEXT: %16 = llvm.insertvalue %7, %15[1] : !llvm<"{ i32, double, i32 }">
// CHECK-NEXT: %17 = llvm.insertvalue %11, %16[2] : !llvm<"{ i32, double, i32 }">
%11 = llvm.extractvalue %10[0] : !llvm<"{ i32, double, i32 }">
%12 = llvm.extractvalue %10[1] : !llvm<"{ i32, double, i32 }">
%13 = llvm.extractvalue %10[2] : !llvm<"{ i32, double, i32 }">
- %14 = llvm.undef : !llvm<"{ i32, double, i32 }">
+ %14 = llvm.mlir.undef : !llvm<"{ i32, double, i32 }">
%15 = llvm.insertvalue %5, %14[0] : !llvm<"{ i32, double, i32 }">
%16 = llvm.insertvalue %7, %15[1] : !llvm<"{ i32, double, i32 }">
%17 = llvm.insertvalue %11, %16[2] : !llvm<"{ i32, double, i32 }">
llvm.return %17 : !llvm<"{ i32, double, i32 }">
// CHECK-NEXT:^bb2(%18: !llvm.i32): // pred: ^bb0
-// CHECK-NEXT: %19 = llvm.undef : !llvm<"{ i32, double, i32 }">
+// CHECK-NEXT: %19 = llvm.mlir.undef : !llvm<"{ i32, double, i32 }">
// CHECK-NEXT: %20 = llvm.insertvalue %18, %19[0] : !llvm<"{ i32, double, i32 }">
// CHECK-NEXT: %21 = llvm.insertvalue %7, %20[1] : !llvm<"{ i32, double, i32 }">
// CHECK-NEXT: %22 = llvm.insertvalue %5, %21[2] : !llvm<"{ i32, double, i32 }">
// CHECK-NEXT: llvm.return %22 : !llvm<"{ i32, double, i32 }">
^bb2(%18: !llvm.i32): // pred: ^bb0
- %19 = llvm.undef : !llvm<"{ i32, double, i32 }">
+ %19 = llvm.mlir.undef : !llvm<"{ i32, double, i32 }">
%20 = llvm.insertvalue %18, %19[0] : !llvm<"{ i32, double, i32 }">
%21 = llvm.insertvalue %7, %20[1] : !llvm<"{ i32, double, i32 }">
%22 = llvm.insertvalue %5, %21[2] : !llvm<"{ i32, double, i32 }">
return
}
// CHECK-LABEL: func @buffer_alloc_aligned
-// CHECK: %[[c4:.*]] = llvm.constant(4 : index) : !llvm.i64
+// CHECK: %[[c4:.*]] = llvm.mlir.constant(4 : index) : !llvm.i64
// CHECK: %[[m:.*]] = llvm.mul %arg0, %[[c4]] : !llvm.i64
-// CHECK: %[[c1:.*]] = llvm.constant(1 : index) : !llvm.i64
-// CHECK: %[[c16:.*]] = llvm.constant(16 : index) : !llvm.i64
+// CHECK: %[[c1:.*]] = llvm.mlir.constant(1 : index) : !llvm.i64
+// CHECK: %[[c16:.*]] = llvm.mlir.constant(16 : index) : !llvm.i64
// CHECK: %[[a:.*]] = llvm.add %[[m]], %[[c16]] : !llvm.i64
// CHECK: %[[s:.*]] = llvm.sub %[[a]], %[[c1]] : !llvm.i64
// CHECK: %[[alloc:.*]] = llvm.call @malloc(%[[s]]) : (!llvm.i64) -> !llvm<"i8*">
return
}
// CHECK-LABEL: func @range(%{{.*}}: !llvm.i64) {
-// CHECK: llvm.constant(0 : index) : !llvm.i64
-// CHECK-NEXT: llvm.constant(1 : index) : !llvm.i64
-// CHECK-NEXT: llvm.undef : !llvm<"{ i64, i64, i64 }">
+// CHECK: llvm.mlir.constant(0 : index) : !llvm.i64
+// CHECK-NEXT: llvm.mlir.constant(1 : index) : !llvm.i64
+// CHECK-NEXT: llvm.mlir.undef : !llvm<"{ i64, i64, i64 }">
// CHECK-NEXT: llvm.insertvalue %{{.*}}, %{{.*}}[0] : !llvm<"{ i64, i64, i64 }">
// CHECK-NEXT: llvm.insertvalue %{{.*}}, %{{.*}}[1] : !llvm<"{ i64, i64, i64 }">
// CHECK-NEXT: llvm.insertvalue %{{.*}}, %{{.*}}[2] : !llvm<"{ i64, i64, i64 }">
return
}
// CHECK-LABEL: func @view
-// CHECK-NEXT: llvm.constant(1 : index) : !llvm.i64
+// CHECK-NEXT: llvm.mlir.constant(1 : index) : !llvm.i64
// CHECK-NEXT: llvm.alloca {{.*}} x !llvm<"{ float*, i64, [1 x i64], [1 x i64] }"> {alignment = 8 : i64} : (!llvm.i64) -> !llvm<"{ float*, i64, [1 x i64], [1 x i64] }*">
// CHECK: llvm.load %{{.*}} : !llvm<"{ float*, i64, [1 x i64], [1 x i64] }*">
// CHECK-NEXT: llvm.extractvalue %{{.*}}[1] : !llvm<"{ i8*, float*, i64 }">
// CHECK-NEXT: llvm.bitcast {{.*}} : !llvm<"float*"> to !llvm<"float*">
// CHECK-NEXT: llvm.insertvalue %{{.*}}, %{{.*}}[0] : !llvm<"{ float*, i64, [1 x i64], [1 x i64] }">
-// CHECK-NEXT: llvm.constant(0 : index) : !llvm.i64
+// CHECK-NEXT: llvm.mlir.constant(0 : index) : !llvm.i64
// CHECK-NEXT: llvm.insertvalue %{{.*}}, %{{.*}}[1] : !llvm<"{ float*, i64, [1 x i64], [1 x i64] }">
-// CHECK-NEXT: llvm.constant(1 : index) : !llvm.i64
+// CHECK-NEXT: llvm.mlir.constant(1 : index) : !llvm.i64
// CHECK-NEXT: llvm.extractvalue %{{.*}}[2] : !llvm<"{ i64, i64, i64 }">
// CHECK-NEXT: llvm.mul %{{.*}}, %{{.*}} : !llvm.i64
// CHECK-NEXT: llvm.insertvalue %{{.*}}, %{{.*}}[3, 0] : !llvm<"{ float*, i64, [1 x i64], [1 x i64] }">
return
}
// CHECK-LABEL: func @view3d
-// CHECK-NEXT: llvm.constant(1 : index) : !llvm.i64
+// CHECK-NEXT: llvm.mlir.constant(1 : index) : !llvm.i64
// CHECK-NEXT: llvm.alloca {{.*}} x !llvm<"{ float*, i64, [3 x i64], [3 x i64] }"> {alignment = 8 : i64} : (!llvm.i64) -> !llvm<"{ float*, i64, [3 x i64], [3 x i64] }*">
// CHECK-NEXT: llvm.load {{.*}} : !llvm<"{ float*, i64, [3 x i64], [3 x i64] }*">
// CHECK: llvm.extractvalue %{{.*}}[2] : !llvm<"{ i64, i64, i64 }">
//
// Subview lowers to range + slice op
// CHECK: llvm.alloca %{{.*}} x !llvm<"{ float*, i64, [2 x i64], [2 x i64] }"> {alignment = 8 : i64} : (!llvm.i64) -> !llvm<"{ float*, i64, [2 x i64], [2 x i64] }*">
-// CHECK: llvm.undef : !llvm<"{ i64, i64, i64 }">
-// CHECK: llvm.undef : !llvm<"{ i64, i64, i64 }">
+// CHECK: llvm.mlir.undef : !llvm<"{ i64, i64, i64 }">
+// CHECK: llvm.mlir.undef : !llvm<"{ i64, i64, i64 }">
// CHECK: llvm.load %{{.*}} : !llvm<"{ float*, i64, [2 x i64], [2 x i64] }*">
//
// Select occurs in slice op lowering
// RUN: mlir-translate -mlir-to-llvmir %s | FileCheck %s
// CHECK: @i32_global = internal global i32 42
-llvm.global @i32_global(42: i32) : !llvm.i32
+llvm.mlir.global @i32_global(42: i32) : !llvm.i32
// CHECK: @i32_global_const = internal constant i53 52
-llvm.global constant @i32_global_const(52: i53) : !llvm.i53
+llvm.mlir.global constant @i32_global_const(52: i53) : !llvm.i53
// CHECK: @float_global = internal global float 0.000000e+00
-llvm.global @float_global(0.0: f32) : !llvm.float
+llvm.mlir.global @float_global(0.0: f32) : !llvm.float
// CHECK: @string_const = internal constant [6 x i8] c"foobar"
-llvm.global constant @string_const("foobar") : !llvm<"[6 x i8]">
+llvm.mlir.global constant @string_const("foobar") : !llvm<"[6 x i8]">
//
// Declarations of the allocation functions to be linked against.
func @global_refs() {
// Check load from globals.
// CHECK: load i32, i32* @i32_global
- %0 = llvm.addressof @i32_global : !llvm<"i32*">
+ %0 = llvm.mlir.addressof @i32_global : !llvm<"i32*">
%1 = llvm.load %0 : !llvm<"i32*">
// Check the contracted form of load from array constants.
// CHECK: load i8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @string_const, i64 0, i64 0)
- %2 = llvm.addressof @string_const : !llvm<"[6 x i8]*">
- %c0 = llvm.constant(0 : index) : !llvm.i64
+ %2 = llvm.mlir.addressof @string_const : !llvm<"[6 x i8]*">
+ %c0 = llvm.mlir.constant(0 : index) : !llvm.i64
%3 = llvm.getelementptr %2[%c0, %c0] : (!llvm<"[6 x i8]*">, !llvm.i64, !llvm.i64) -> !llvm<"i8*">
%4 = llvm.load %3 : !llvm<"i8*">
// CHECK: [[SIMPLE_bb1]]:
// CHECK-NEXT: br label %[[SIMPLE_bb2:[0-9]+]]
^bb1: // pred: ^bb0
- %0 = llvm.constant(1 : index) : !llvm.i64
- %1 = llvm.constant(42 : index) : !llvm.i64
+ %0 = llvm.mlir.constant(1 : index) : !llvm.i64
+ %1 = llvm.mlir.constant(42 : index) : !llvm.i64
llvm.br ^bb2(%0 : !llvm.i64)
// CHECK: [[SIMPLE_bb2]]:
// CHECK-NEXT: br label %[[SIMPLE_bb2]]
^bb3: // pred: ^bb2
llvm.call @body(%2) : (!llvm.i64) -> ()
- %4 = llvm.constant(1 : index) : !llvm.i64
+ %4 = llvm.mlir.constant(1 : index) : !llvm.i64
%5 = llvm.add %2, %4 : !llvm.i64
llvm.br ^bb2(%5 : !llvm.i64)
// CHECK-LABEL: define i32 @func_args(i32 {{%.*}}, i32 {{%.*}}) {
// CHECK-NEXT: br label %[[ARGS_bb1:[0-9]+]]
func @func_args(%arg0: !llvm.i32, %arg1: !llvm.i32) -> !llvm.i32 {
- %0 = llvm.constant(0 : i32) : !llvm.i32
+ %0 = llvm.mlir.constant(0 : i32) : !llvm.i32
llvm.br ^bb1
// CHECK: [[ARGS_bb1]]:
// CHECK-NEXT: br label %[[ARGS_bb2:[0-9]+]]
^bb1: // pred: ^bb0
- %1 = llvm.constant(0 : index) : !llvm.i64
- %2 = llvm.constant(42 : index) : !llvm.i64
+ %1 = llvm.mlir.constant(0 : index) : !llvm.i64
+ %2 = llvm.mlir.constant(42 : index) : !llvm.i64
llvm.br ^bb2(%1 : !llvm.i64)
// CHECK: [[ARGS_bb2]]:
%6 = llvm.call @other(%5, %arg0) : (!llvm.i64, !llvm.i32) -> !llvm.i32
%7 = llvm.call @other(%5, %6) : (!llvm.i64, !llvm.i32) -> !llvm.i32
%8 = llvm.call @other(%5, %arg1) : (!llvm.i64, !llvm.i32) -> !llvm.i32
- %9 = llvm.constant(1 : index) : !llvm.i64
+ %9 = llvm.mlir.constant(1 : index) : !llvm.i64
%10 = llvm.add %3, %9 : !llvm.i64
llvm.br ^bb2(%10 : !llvm.i64)
// CHECK-NEXT: %14 = call i32 @other(i64 0, i32 0)
// CHECK-NEXT: ret i32 %14
^bb4: // pred: ^bb2
- %11 = llvm.constant(0 : index) : !llvm.i64
+ %11 = llvm.mlir.constant(0 : index) : !llvm.i64
%12 = llvm.call @other(%11, %0) : (!llvm.i64, !llvm.i32) -> !llvm.i32
llvm.return %12 : !llvm.i32
}
// CHECK: [[IMPER_bb1]]:
// CHECK-NEXT: br label %[[IMPER_bb2:[0-9]+]]
^bb1: // pred: ^bb0
- %0 = llvm.constant(0 : index) : !llvm.i64
- %1 = llvm.constant(42 : index) : !llvm.i64
+ %0 = llvm.mlir.constant(0 : index) : !llvm.i64
+ %1 = llvm.mlir.constant(42 : index) : !llvm.i64
llvm.br ^bb2(%0 : !llvm.i64)
// CHECK: [[IMPER_bb2]]:
// CHECK: [[IMPER_bb4]]:
// CHECK-NEXT: br label %[[IMPER_bb5:[0-9]+]]
^bb4: // pred: ^bb3
- %4 = llvm.constant(7 : index) : !llvm.i64
- %5 = llvm.constant(56 : index) : !llvm.i64
+ %4 = llvm.mlir.constant(7 : index) : !llvm.i64
+ %5 = llvm.mlir.constant(56 : index) : !llvm.i64
llvm.br ^bb5(%4 : !llvm.i64)
// CHECK: [[IMPER_bb5]]:
// CHECK-NEXT: br label %[[IMPER_bb5]]
^bb6: // pred: ^bb5
llvm.call @body2(%2, %6) : (!llvm.i64, !llvm.i64) -> ()
- %8 = llvm.constant(2 : index) : !llvm.i64
+ %8 = llvm.mlir.constant(2 : index) : !llvm.i64
%9 = llvm.add %6, %8 : !llvm.i64
llvm.br ^bb5(%9 : !llvm.i64)
// CHECK-NEXT: br label %[[IMPER_bb2]]
^bb7: // pred: ^bb5
llvm.call @post(%2) : (!llvm.i64) -> ()
- %10 = llvm.constant(1 : index) : !llvm.i64
+ %10 = llvm.mlir.constant(1 : index) : !llvm.i64
%11 = llvm.add %2, %10 : !llvm.i64
llvm.br ^bb2(%11 : !llvm.i64)
func @more_imperfectly_nested_loops() {
llvm.br ^bb1
^bb1: // pred: ^bb0
- %0 = llvm.constant(0 : index) : !llvm.i64
- %1 = llvm.constant(42 : index) : !llvm.i64
+ %0 = llvm.mlir.constant(0 : index) : !llvm.i64
+ %1 = llvm.mlir.constant(42 : index) : !llvm.i64
llvm.br ^bb2(%0 : !llvm.i64)
^bb2(%2: !llvm.i64): // 2 preds: ^bb1, ^bb11
%3 = llvm.icmp "slt" %2, %1 : !llvm.i64
llvm.call @pre(%2) : (!llvm.i64) -> ()
llvm.br ^bb4
^bb4: // pred: ^bb3
- %4 = llvm.constant(7 : index) : !llvm.i64
- %5 = llvm.constant(56 : index) : !llvm.i64
+ %4 = llvm.mlir.constant(7 : index) : !llvm.i64
+ %5 = llvm.mlir.constant(56 : index) : !llvm.i64
llvm.br ^bb5(%4 : !llvm.i64)
^bb5(%6: !llvm.i64): // 2 preds: ^bb4, ^bb6
%7 = llvm.icmp "slt" %6, %5 : !llvm.i64
llvm.cond_br %7, ^bb6, ^bb7
^bb6: // pred: ^bb5
llvm.call @body2(%2, %6) : (!llvm.i64, !llvm.i64) -> ()
- %8 = llvm.constant(2 : index) : !llvm.i64
+ %8 = llvm.mlir.constant(2 : index) : !llvm.i64
%9 = llvm.add %6, %8 : !llvm.i64
llvm.br ^bb5(%9 : !llvm.i64)
^bb7: // pred: ^bb5
llvm.call @mid(%2) : (!llvm.i64) -> ()
llvm.br ^bb8
^bb8: // pred: ^bb7
- %10 = llvm.constant(18 : index) : !llvm.i64
- %11 = llvm.constant(37 : index) : !llvm.i64
+ %10 = llvm.mlir.constant(18 : index) : !llvm.i64
+ %11 = llvm.mlir.constant(37 : index) : !llvm.i64
llvm.br ^bb9(%10 : !llvm.i64)
^bb9(%12: !llvm.i64): // 2 preds: ^bb8, ^bb10
%13 = llvm.icmp "slt" %12, %11 : !llvm.i64
llvm.cond_br %13, ^bb10, ^bb11
^bb10: // pred: ^bb9
llvm.call @body3(%2, %12) : (!llvm.i64, !llvm.i64) -> ()
- %14 = llvm.constant(3 : index) : !llvm.i64
+ %14 = llvm.mlir.constant(3 : index) : !llvm.i64
%15 = llvm.add %12, %14 : !llvm.i64
llvm.br ^bb9(%15 : !llvm.i64)
^bb11: // pred: ^bb9
llvm.call @post(%2) : (!llvm.i64) -> ()
- %16 = llvm.constant(1 : index) : !llvm.i64
+ %16 = llvm.mlir.constant(1 : index) : !llvm.i64
%17 = llvm.add %2, %16 : !llvm.i64
llvm.br ^bb2(%17 : !llvm.i64)
^bb12: // pred: ^bb2
// CHECK-NEXT: %{{[0-9]+}} = call i8* @malloc(i64 400)
// CHECK-NEXT: %{{[0-9]+}} = bitcast i8* %{{[0-9]+}} to float*
// CHECK-NEXT: %{{[0-9]+}} = insertvalue { float* } undef, float* %{{[0-9]+}}, 0
- %0 = llvm.constant(10 : index) : !llvm.i64
- %1 = llvm.constant(10 : index) : !llvm.i64
+ %0 = llvm.mlir.constant(10 : index) : !llvm.i64
+ %1 = llvm.mlir.constant(10 : index) : !llvm.i64
%2 = llvm.mul %0, %1 : !llvm.i64
- %3 = llvm.undef : !llvm<"{ float* }">
- %4 = llvm.constant(4 : index) : !llvm.i64
+ %3 = llvm.mlir.undef : !llvm<"{ float* }">
+ %4 = llvm.mlir.constant(4 : index) : !llvm.i64
%5 = llvm.mul %2, %4 : !llvm.i64
%6 = llvm.call @malloc(%5) : (!llvm.i64) -> !llvm<"i8*">
%7 = llvm.bitcast %6 : !llvm<"i8*"> to !llvm<"float*">
// CHECK-NEXT: %{{[0-9]+}} = call i8* @malloc(i64 40)
// CHECK-NEXT: %{{[0-9]+}} = bitcast i8* %{{[0-9]+}} to float*
// CHECK-NEXT: %{{[0-9]+}} = insertvalue { float* } undef, float* %{{[0-9]+}}, 0
- %0 = llvm.constant(10 : index) : !llvm.i64
- %1 = llvm.undef : !llvm<"{ float* }">
- %2 = llvm.constant(4 : index) : !llvm.i64
+ %0 = llvm.mlir.constant(10 : index) : !llvm.i64
+ %1 = llvm.mlir.undef : !llvm<"{ float* }">
+ %2 = llvm.mlir.constant(4 : index) : !llvm.i64
%3 = llvm.mul %0, %2 : !llvm.i64
%4 = llvm.call @malloc(%3) : (!llvm.i64) -> !llvm<"i8*">
%5 = llvm.bitcast %4 : !llvm<"i8*"> to !llvm<"float*">
%6 = llvm.insertvalue %5, %1[0] : !llvm<"{ float* }">
- %7 = llvm.constant(1.000000e+00 : f32) : !llvm.float
+ %7 = llvm.mlir.constant(1.000000e+00 : f32) : !llvm.float
llvm.br ^bb1
^bb1: // pred: ^bb0
- %8 = llvm.constant(0 : index) : !llvm.i64
- %9 = llvm.constant(10 : index) : !llvm.i64
+ %8 = llvm.mlir.constant(0 : index) : !llvm.i64
+ %9 = llvm.mlir.constant(10 : index) : !llvm.i64
llvm.br ^bb2(%8 : !llvm.i64)
// CHECK: %{{[0-9]+}} = phi i64 [ %{{[0-9]+}}, %{{[0-9]+}} ], [ 0, %{{[0-9]+}} ]
^bb2(%10: !llvm.i64): // 2 preds: ^bb1, ^bb3
// CHECK: %{{[0-9]+}} = extractvalue { float* } %{{[0-9]+}}, 0
// CHECK-NEXT: %{{[0-9]+}} = getelementptr float, float* %{{[0-9]+}}, i64 %{{[0-9]+}}
// CHECK-NEXT: store float 1.000000e+00, float* %{{[0-9]+}}
- %12 = llvm.constant(10 : index) : !llvm.i64
+ %12 = llvm.mlir.constant(10 : index) : !llvm.i64
%13 = llvm.extractvalue %6[0] : !llvm<"{ float* }">
%14 = llvm.getelementptr %13[%10] : (!llvm<"float*">, !llvm.i64) -> !llvm<"float*">
llvm.store %7, %14 : !llvm<"float*">
- %15 = llvm.constant(1 : index) : !llvm.i64
+ %15 = llvm.mlir.constant(1 : index) : !llvm.i64
// CHECK-NEXT: %{{[0-9]+}} = add i64 %{{[0-9]+}}, 1
%16 = llvm.add %10, %15 : !llvm.i64
// CHECK-NEXT: br label %{{[0-9]+}}
^bb4: // pred: ^bb2
llvm.br ^bb5
^bb5: // pred: ^bb4
- %17 = llvm.constant(0 : index) : !llvm.i64
- %18 = llvm.constant(10 : index) : !llvm.i64
+ %17 = llvm.mlir.constant(0 : index) : !llvm.i64
+ %18 = llvm.mlir.constant(10 : index) : !llvm.i64
llvm.br ^bb6(%17 : !llvm.i64)
// CHECK: %{{[0-9]+}} = phi i64 [ %{{[0-9]+}}, %{{[0-9]+}} ], [ 0, %{{[0-9]+}} ]
^bb6(%19: !llvm.i64): // 2 preds: ^bb5, ^bb7
// CHECK: %{{[0-9]+}} = extractvalue { float* } %{{[0-9]+}}, 0
// CHECK-NEXT: %{{[0-9]+}} = getelementptr float, float* %{{[0-9]+}}, i64 %{{[0-9]+}}
// CHECK-NEXT: %{{[0-9]+}} = load float, float* %{{[0-9]+}}
- %21 = llvm.constant(10 : index) : !llvm.i64
+ %21 = llvm.mlir.constant(10 : index) : !llvm.i64
%22 = llvm.extractvalue %6[0] : !llvm<"{ float* }">
%23 = llvm.getelementptr %22[%19] : (!llvm<"float*">, !llvm.i64) -> !llvm<"float*">
%24 = llvm.load %23 : !llvm<"float*">
- %25 = llvm.constant(1 : index) : !llvm.i64
+ %25 = llvm.mlir.constant(1 : index) : !llvm.i64
// CHECK-NEXT: %{{[0-9]+}} = add i64 %{{[0-9]+}}, 1
%26 = llvm.add %19, %25 : !llvm.i64
// CHECK-NEXT: br label %{{[0-9]+}}
// CHECK-NEXT: %{{[0-9]+}} = bitcast i8* %{{[0-9]+}} to float*
// CHECK-NEXT: %{{[0-9]+}} = insertvalue { float*, i64 } undef, float* %{{[0-9]+}}, 0
// CHECK-NEXT: %{{[0-9]+}} = insertvalue { float*, i64 } %{{[0-9]+}}, i64 %{{[0-9]+}}, 1
- %0 = llvm.undef : !llvm<"{ float*, i64 }">
- %1 = llvm.constant(4 : index) : !llvm.i64
+ %0 = llvm.mlir.undef : !llvm<"{ float*, i64 }">
+ %1 = llvm.mlir.constant(4 : index) : !llvm.i64
%2 = llvm.mul %arg0, %1 : !llvm.i64
%3 = llvm.call @malloc(%2) : (!llvm.i64) -> !llvm<"i8*">
%4 = llvm.bitcast %3 : !llvm<"i8*"> to !llvm<"float*">
%5 = llvm.insertvalue %4, %0[0] : !llvm<"{ float*, i64 }">
%6 = llvm.insertvalue %arg0, %5[1] : !llvm<"{ float*, i64 }">
- %7 = llvm.constant(1.000000e+00 : f32) : !llvm.float
+ %7 = llvm.mlir.constant(1.000000e+00 : f32) : !llvm.float
// CHECK-NEXT: br label %{{[0-9]+}}
llvm.br ^bb1
^bb1: // pred: ^bb0
- %8 = llvm.constant(0 : index) : !llvm.i64
+ %8 = llvm.mlir.constant(0 : index) : !llvm.i64
llvm.br ^bb2(%8 : !llvm.i64)
// CHECK: %{{[0-9]+}} = phi i64 [ %{{[0-9]+}}, %{{[0-9]+}} ], [ 0, %{{[0-9]+}} ]
^bb2(%9: !llvm.i64): // 2 preds: ^bb1, ^bb3
%12 = llvm.extractvalue %6[0] : !llvm<"{ float*, i64 }">
%13 = llvm.getelementptr %12[%9] : (!llvm<"float*">, !llvm.i64) -> !llvm<"float*">
llvm.store %7, %13 : !llvm<"float*">
- %14 = llvm.constant(1 : index) : !llvm.i64
+ %14 = llvm.mlir.constant(1 : index) : !llvm.i64
// CHECK-NEXT: %{{[0-9]+}} = add i64 %{{[0-9]+}}, 1
%15 = llvm.add %9, %14 : !llvm.i64
// CHECK-NEXT: br label %{{[0-9]+}}
^bb4: // pred: ^bb3
llvm.br ^bb5
^bb5: // pred: ^bb4
- %16 = llvm.constant(0 : index) : !llvm.i64
+ %16 = llvm.mlir.constant(0 : index) : !llvm.i64
llvm.br ^bb6(%16 : !llvm.i64)
// CHECK: %{{[0-9]+}} = phi i64 [ %{{[0-9]+}}, %{{[0-9]+}} ], [ 0, %{{[0-9]+}} ]
^bb6(%17: !llvm.i64): // 2 preds: ^bb5, ^bb7
%20 = llvm.extractvalue %6[0] : !llvm<"{ float*, i64 }">
%21 = llvm.getelementptr %20[%17] : (!llvm<"float*">, !llvm.i64) -> !llvm<"float*">
%22 = llvm.load %21 : !llvm<"float*">
- %23 = llvm.constant(1 : index) : !llvm.i64
+ %23 = llvm.mlir.constant(1 : index) : !llvm.i64
// CHECK-NEXT: %{{[0-9]+}} = add i64 %{{[0-9]+}}, 1
%24 = llvm.add %17, %23 : !llvm.i64
// CHECK-NEXT: br label %{{[0-9]+}}
// CHECK-LABEL: define void @store_load_mixed(i64 {{%.*}})
func @store_load_mixed(%arg0: !llvm.i64) {
- %0 = llvm.constant(10 : index) : !llvm.i64
+ %0 = llvm.mlir.constant(10 : index) : !llvm.i64
// CHECK-NEXT: %{{[0-9]+}} = mul i64 2, %{{[0-9]+}}
// CHECK-NEXT: %{{[0-9]+}} = mul i64 %{{[0-9]+}}, 4
// CHECK-NEXT: %{{[0-9]+}} = mul i64 %{{[0-9]+}}, 10
// CHECK-NEXT: %{{[0-9]+}} = insertvalue { float*, i64, i64 } undef, float* %{{[0-9]+}}, 0
// CHECK-NEXT: %{{[0-9]+}} = insertvalue { float*, i64, i64 } %{{[0-9]+}}, i64 %{{[0-9]+}}, 1
// CHECK-NEXT: %{{[0-9]+}} = insertvalue { float*, i64, i64 } %{{[0-9]+}}, i64 10, 2
- %1 = llvm.constant(2 : index) : !llvm.i64
- %2 = llvm.constant(4 : index) : !llvm.i64
+ %1 = llvm.mlir.constant(2 : index) : !llvm.i64
+ %2 = llvm.mlir.constant(4 : index) : !llvm.i64
%3 = llvm.mul %1, %arg0 : !llvm.i64
%4 = llvm.mul %3, %2 : !llvm.i64
%5 = llvm.mul %4, %0 : !llvm.i64
- %6 = llvm.undef : !llvm<"{ float*, i64, i64 }">
- %7 = llvm.constant(4 : index) : !llvm.i64
+ %6 = llvm.mlir.undef : !llvm<"{ float*, i64, i64 }">
+ %7 = llvm.mlir.constant(4 : index) : !llvm.i64
%8 = llvm.mul %5, %7 : !llvm.i64
%9 = llvm.call @malloc(%8) : (!llvm.i64) -> !llvm<"i8*">
%10 = llvm.bitcast %9 : !llvm<"i8*"> to !llvm<"float*">
// CHECK-NEXT: %{{[0-9]+}} = call i64 @get_index()
// CHECK-NEXT: %{{[0-9]+}} = call i64 @get_index()
- %14 = llvm.constant(1 : index) : !llvm.i64
- %15 = llvm.constant(2 : index) : !llvm.i64
+ %14 = llvm.mlir.constant(1 : index) : !llvm.i64
+ %15 = llvm.mlir.constant(2 : index) : !llvm.i64
%16 = llvm.call @get_index() : () -> !llvm.i64
%17 = llvm.call @get_index() : () -> !llvm.i64
- %18 = llvm.constant(4.200000e+01 : f32) : !llvm.float
- %19 = llvm.constant(2 : index) : !llvm.i64
+ %18 = llvm.mlir.constant(4.200000e+01 : f32) : !llvm.float
+ %19 = llvm.mlir.constant(2 : index) : !llvm.i64
// CHECK-NEXT: %{{[0-9]+}} = extractvalue { float*, i64, i64 } %{{[0-9]+}}, 1
// CHECK-NEXT: %{{[0-9]+}} = extractvalue { float*, i64, i64 } %{{[0-9]+}}, 2
// CHECK-NEXT: %{{[0-9]+}} = mul i64 1, %{{[0-9]+}}
// CHECK-NEXT: %{{[0-9]+}} = getelementptr float, float* %{{[0-9]+}}, i64 %{{[0-9]+}}
// CHECK-NEXT: store float 4.200000e+01, float* %{{[0-9]+}}
%20 = llvm.extractvalue %13[1] : !llvm<"{ float*, i64, i64 }">
- %21 = llvm.constant(4 : index) : !llvm.i64
+ %21 = llvm.mlir.constant(4 : index) : !llvm.i64
%22 = llvm.extractvalue %13[2] : !llvm<"{ float*, i64, i64 }">
%23 = llvm.mul %14, %20 : !llvm.i64
%24 = llvm.add %23, %15 : !llvm.i64
// CHECK-NEXT: %{{[0-9]+}} = extractvalue { float*, i64, i64 } %{{[0-9]+}}, 0
// CHECK-NEXT: %{{[0-9]+}} = getelementptr float, float* %{{[0-9]+}}, i64 %{{[0-9]+}}
// CHECK-NEXT: %{{[0-9]+}} = load float, float* %{{[0-9]+}}
- %31 = llvm.constant(2 : index) : !llvm.i64
+ %31 = llvm.mlir.constant(2 : index) : !llvm.i64
%32 = llvm.extractvalue %13[1] : !llvm<"{ float*, i64, i64 }">
- %33 = llvm.constant(4 : index) : !llvm.i64
+ %33 = llvm.mlir.constant(4 : index) : !llvm.i64
%34 = llvm.extractvalue %13[2] : !llvm<"{ float*, i64, i64 }">
%35 = llvm.mul %17, %32 : !llvm.i64
%36 = llvm.add %35, %16 : !llvm.i64
// CHECK-LABEL: define { float*, i64 } @memref_args_rets({ float* } {{%.*}}, { float*, i64 } {{%.*}}, { float*, i64 } {{%.*}}) {
func @memref_args_rets(%arg0: !llvm<"{ float* }">, %arg1: !llvm<"{ float*, i64 }">, %arg2: !llvm<"{ float*, i64 }">) -> !llvm<"{ float*, i64 }"> {
- %0 = llvm.constant(7 : index) : !llvm.i64
+ %0 = llvm.mlir.constant(7 : index) : !llvm.i64
// CHECK-NEXT: %{{[0-9]+}} = call i64 @get_index()
%1 = llvm.call @get_index() : () -> !llvm.i64
- %2 = llvm.constant(4.200000e+01 : f32) : !llvm.float
+ %2 = llvm.mlir.constant(4.200000e+01 : f32) : !llvm.float
// CHECK-NEXT: %{{[0-9]+}} = extractvalue { float* } %{{[0-9]+}}, 0
// CHECK-NEXT: %{{[0-9]+}} = getelementptr float, float* %{{[0-9]+}}, i64 7
// CHECK-NEXT: store float 4.200000e+01, float* %{{[0-9]+}}
- %3 = llvm.constant(10 : index) : !llvm.i64
+ %3 = llvm.mlir.constant(10 : index) : !llvm.i64
%4 = llvm.extractvalue %arg0[0] : !llvm<"{ float* }">
%5 = llvm.getelementptr %4[%0] : (!llvm<"float*">, !llvm.i64) -> !llvm<"float*">
llvm.store %2, %5 : !llvm<"float*">
// CHECK-NEXT: %{{[0-9]+}} = extractvalue { float*, i64 } %{{[0-9]+}}, 0
// CHECK-NEXT: %{{[0-9]+}} = getelementptr float, float* %{{[0-9]+}}, i64 %{{[0-9]+}}
// CHECK-NEXT: store float 4.200000e+01, float* %{{[0-9]+}}
- %9 = llvm.constant(10 : index) : !llvm.i64
+ %9 = llvm.mlir.constant(10 : index) : !llvm.i64
%10 = llvm.extractvalue %arg2[1] : !llvm<"{ float*, i64 }">
%11 = llvm.mul %0, %10 : !llvm.i64
%12 = llvm.add %11, %1 : !llvm.i64
// CHECK-NEXT: %{{[0-9]+}} = bitcast i8* %{{[0-9]+}} to float*
// CHECK-NEXT: %{{[0-9]+}} = insertvalue { float*, i64 } undef, float* %{{[0-9]+}}, 0
// CHECK-NEXT: %{{[0-9]+}} = insertvalue { float*, i64 } %{{[0-9]+}}, i64 %{{[0-9]+}}, 1
- %15 = llvm.constant(10 : index) : !llvm.i64
+ %15 = llvm.mlir.constant(10 : index) : !llvm.i64
%16 = llvm.mul %15, %1 : !llvm.i64
- %17 = llvm.undef : !llvm<"{ float*, i64 }">
- %18 = llvm.constant(4 : index) : !llvm.i64
+ %17 = llvm.mlir.undef : !llvm<"{ float*, i64 }">
+ %18 = llvm.mlir.constant(4 : index) : !llvm.i64
%19 = llvm.mul %16, %18 : !llvm.i64
%20 = llvm.call @malloc(%19) : (!llvm.i64) -> !llvm<"i8*">
%21 = llvm.bitcast %20 : !llvm<"i8*"> to !llvm<"float*">
// CHECK-LABEL: define i64 @memref_dim({ float*, i64, i64 } {{%.*}})
func @memref_dim(%arg0: !llvm<"{ float*, i64, i64 }">) -> !llvm.i64 {
// Expecting this to create an LLVM constant.
- %0 = llvm.constant(42 : index) : !llvm.i64
+ %0 = llvm.mlir.constant(42 : index) : !llvm.i64
// CHECK-NEXT: %2 = extractvalue { float*, i64, i64 } %0, 1
%1 = llvm.extractvalue %arg0[1] : !llvm<"{ float*, i64, i64 }">
// Expecting this to create an LLVM constant.
- %2 = llvm.constant(10 : index) : !llvm.i64
+ %2 = llvm.mlir.constant(10 : index) : !llvm.i64
// CHECK-NEXT: %3 = extractvalue { float*, i64, i64 } %0, 2
%3 = llvm.extractvalue %arg0[2] : !llvm<"{ float*, i64, i64 }">
// Checking that the constant for d0 has been created.
// CHECK-NEXT: %{{[0-9]+}} = insertvalue { i64, float, { float*, i64, i64 } } %{{[0-9]+}}, float %{{[0-9]+}}, 1
// CHECK-NEXT: %{{[0-9]+}} = insertvalue { i64, float, { float*, i64, i64 } } %{{[0-9]+}}, { float*, i64, i64 } %{{[0-9]+}}, 2
// CHECK-NEXT: ret { i64, float, { float*, i64, i64 } } %{{[0-9]+}}
- %3 = llvm.undef : !llvm<"{ i64, float, { float*, i64, i64 } }">
+ %3 = llvm.mlir.undef : !llvm<"{ i64, float, { float*, i64, i64 } }">
%4 = llvm.insertvalue %0, %3[0] : !llvm<"{ i64, float, { float*, i64, i64 } }">
%5 = llvm.insertvalue %1, %4[1] : !llvm<"{ i64, float, { float*, i64, i64 } }">
%6 = llvm.insertvalue %2, %5[2] : !llvm<"{ i64, float, { float*, i64, i64 } }">
%1 = llvm.extractvalue %0[0] : !llvm<"{ i64, float, { float*, i64, i64 } }">
%2 = llvm.extractvalue %0[1] : !llvm<"{ i64, float, { float*, i64, i64 } }">
%3 = llvm.extractvalue %0[2] : !llvm<"{ i64, float, { float*, i64, i64 } }">
- %4 = llvm.constant(42) : !llvm.i64
+ %4 = llvm.mlir.constant(42) : !llvm.i64
// CHECK: add i64 [[ret0]], 42
%5 = llvm.add %1, %4 : !llvm.i64
- %6 = llvm.constant(4.200000e+01 : f32) : !llvm.float
+ %6 = llvm.mlir.constant(4.200000e+01 : f32) : !llvm.float
// CHECK: fadd float [[ret1]], 4.200000e+01
%7 = llvm.fadd %2, %6 : !llvm.float
- %8 = llvm.constant(0 : index) : !llvm.i64
- %9 = llvm.constant(42 : index) : !llvm.i64
+ %8 = llvm.mlir.constant(0 : index) : !llvm.i64
+ %9 = llvm.mlir.constant(42 : index) : !llvm.i64
// CHECK: extractvalue { float*, i64, i64 } [[ret2]], 0
%10 = llvm.extractvalue %3[1] : !llvm<"{ float*, i64, i64 }">
- %11 = llvm.constant(10 : index) : !llvm.i64
+ %11 = llvm.mlir.constant(10 : index) : !llvm.i64
%12 = llvm.extractvalue %3[2] : !llvm<"{ float*, i64, i64 }">
%13 = llvm.mul %8, %10 : !llvm.i64
%14 = llvm.add %13, %8 : !llvm.i64
// CHECK-LABEL: define <4 x float> @vector_ops(<4 x float> {{%.*}}, <4 x i1> {{%.*}}, <4 x i64> {{%.*}}) {
func @vector_ops(%arg0: !llvm<"<4 x float>">, %arg1: !llvm<"<4 x i1>">, %arg2: !llvm<"<4 x i64>">) -> !llvm<"<4 x float>"> {
- %0 = llvm.constant(dense<4.200000e+01> : vector<4xf32>) : !llvm<"<4 x float>">
+ %0 = llvm.mlir.constant(dense<4.200000e+01> : vector<4xf32>) : !llvm<"<4 x float>">
// CHECK-NEXT: %4 = fadd <4 x float> %0, <float 4.200000e+01, float 4.200000e+01, float 4.200000e+01, float 4.200000e+01>
%1 = llvm.fadd %arg0, %0 : !llvm<"<4 x float>">
// CHECK-NEXT: %5 = select <4 x i1> %1, <4 x float> %4, <4 x float> %0
// CHECK-NEXT: %12 = urem i32 %2, %3
%7 = llvm.urem %arg2, %arg3 : !llvm.i32
- %8 = llvm.undef : !llvm<"{ float, i32 }">
+ %8 = llvm.mlir.undef : !llvm<"{ float, i32 }">
%9 = llvm.insertvalue %0, %8[0] : !llvm<"{ float, i32 }">
%10 = llvm.insertvalue %3, %9[1] : !llvm<"{ float, i32 }">
// CHECK-LABEL: define void @indirect_const_call(i64 {{%.*}}) {
func @indirect_const_call(%arg0: !llvm.i64) {
// CHECK-NEXT: call void @body(i64 %0)
- %0 = llvm.constant(@body) : !llvm<"void (i64)*">
+ %0 = llvm.mlir.constant(@body) : !llvm<"void (i64)*">
llvm.call %0(%arg0) : (!llvm.i64) -> ()
// CHECK-NEXT: ret void
llvm.return
}
func @stringconstant() -> !llvm<"i8*"> {
- %1 = llvm.constant("Hello world!") : !llvm<"i8*">
+ %1 = llvm.mlir.constant("Hello world!") : !llvm<"i8*">
// CHECK: ret [12 x i8] c"Hello world!"
llvm.return %1 : !llvm<"i8*">
}
// CHECK-LABEL: @constants
func @constants() -> !llvm<"<4 x float>"> {
// CHECK: ret <4 x float> <float 4.2{{0*}}e+01, float 0.{{0*}}e+00, float 0.{{0*}}e+00, float 0.{{0*}}e+00>
- %0 = llvm.constant(sparse<[[0]], [4.2e+01]> : vector<4xf32>) : !llvm<"<4 x float>">
+ %0 = llvm.mlir.constant(sparse<[[0]], [4.2e+01]> : vector<4xf32>) : !llvm<"<4 x float>">
llvm.return %0 : !llvm<"<4 x float>">
}