Skip to content

Commit 8b37cb3

Browse files
authored
[core] Some enhancements to the cc.insert_value op. (#2589)
Fixes a typo in the syntax so that the argument order matches the type of the arguments. Adds a verifier. Fix up the tests to reflect the changes. Signed-off-by: Eric Schweitz <eschweitz@nvidia.com>
1 parent 5e9dc6a commit 8b37cb3

File tree

18 files changed

+202
-97
lines changed

18 files changed

+202
-97
lines changed

include/cudaq/Optimizer/Dialect/CC/CCOps.td

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ def AnyCallableType : Type<CPred<"$_self.isa<cudaq::cc::CallableType, "
2424
"mlir::FunctionType>()">, "any callable type">;
2525

2626
def AnyAggregateType : Type<CPred<"$_self.isa<cudaq::cc::StructType, "
27-
"cudaq::cc::ArrayType>()">, "any aggregate type">;
27+
"cudaq::cc::ArrayType, mlir::ComplexType>()">,
28+
"any aggregate type">;
2829

2930
//===----------------------------------------------------------------------===//
3031
// Base operation definition.
@@ -1022,10 +1023,12 @@ def cc_InsertValueOp : CCOp<"insert_value", [Pure]> {
10221023
let results = (outs AnyAggregateType);
10231024

10241025
let assemblyFormat = [{
1025-
$value `,` $container `` $position `:` functional-type(operands, results)
1026+
$container `` $position `,` $value `:` functional-type(operands, results)
10261027
attr-dict
10271028
}];
10281029

1030+
let hasVerifier = 1;
1031+
10291032
let builders = [
10301033
OpBuilder<(ins "mlir::Type":$resultType, "mlir::Value":$aggregate,
10311034
"mlir::Value":$newValue, "std::int64_t":$index), [{

lib/Optimizer/Builder/Intrinsics.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -264,8 +264,8 @@ static constexpr IntrinsicCode intrinsicTable[] = {
264264
%6 = cc.compute_ptr %10[%arg1] : (!cc.ptr<!cc.array<i8 x ?>>, i64) -> !cc.ptr<i8>
265265
call @llvm.memcpy.p0i8.p0i8.i64(%6, %5, %1, %false) : (!cc.ptr<i8>, !cc.ptr<i8>, i64, i1) -> ()
266266
%7 = cc.undef !cc.struct<{!cc.ptr<i8>, i64}>
267-
%8 = cc.insert_value %3, %7[0] : (!cc.struct<{!cc.ptr<i8>, i64}>, !cc.ptr<i8>) -> !cc.struct<{!cc.ptr<i8>, i64}>
268-
%9 = cc.insert_value %2, %8[1] : (!cc.struct<{!cc.ptr<i8>, i64}>, i64) -> !cc.struct<{!cc.ptr<i8>, i64}>
267+
%8 = cc.insert_value %7[0], %3 : (!cc.struct<{!cc.ptr<i8>, i64}>, !cc.ptr<i8>) -> !cc.struct<{!cc.ptr<i8>, i64}>
268+
%9 = cc.insert_value %8[1], %2 : (!cc.struct<{!cc.ptr<i8>, i64}>, i64) -> !cc.struct<{!cc.ptr<i8>, i64}>
269269
%11 = cc.compute_ptr %10[%arg3] : (!cc.ptr<!cc.array<i8 x ?>>, i64) -> !cc.ptr<i8>
270270
%12 = cc.cast %11 : (!cc.ptr<i8>) -> !cc.ptr<!cc.ptr<i8>>
271271
cc.store %6, %12 : !cc.ptr<!cc.ptr<i8>>
@@ -345,8 +345,8 @@ static constexpr IntrinsicCode intrinsicTable[] = {
345345
%c0_i64 = arith.constant 0 : i64
346346
%0 = cc.cast %c0_i64 : (i64) -> !cc.ptr<i8>
347347
%1 = cc.undef !cc.struct<{!cc.ptr<i8>, i64}>
348-
%2 = cc.insert_value %0, %1[0] : (!cc.struct<{!cc.ptr<i8>, i64}>, !cc.ptr<i8>) -> !cc.struct<{!cc.ptr<i8>, i64}>
349-
%3 = cc.insert_value %c0_i64, %2[1] : (!cc.struct<{!cc.ptr<i8>, i64}>, i64) -> !cc.struct<{!cc.ptr<i8>, i64}>
348+
%2 = cc.insert_value %1[0], %0 : (!cc.struct<{!cc.ptr<i8>, i64}>, !cc.ptr<i8>) -> !cc.struct<{!cc.ptr<i8>, i64}>
349+
%3 = cc.insert_value %2[1], %c0_i64 : (!cc.struct<{!cc.ptr<i8>, i64}>, i64) -> !cc.struct<{!cc.ptr<i8>, i64}>
350350
return %3 : !cc.struct<{!cc.ptr<i8>, i64}>
351351
})#"},
352352

lib/Optimizer/Dialect/CC/CCOps.cpp

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1064,6 +1064,45 @@ void cudaq::cc::GlobalOp::print(OpAsmPrinter &p) {
10641064
getExternalAttrName(), getSymVisibilityAttrName()});
10651065
}
10661066

1067+
//===----------------------------------------------------------------------===//
1068+
// InsertValueOp
1069+
//===----------------------------------------------------------------------===//
1070+
1071+
LogicalResult cudaq::cc::InsertValueOp::verify() {
1072+
Type eleTy = getContainer().getType();
1073+
auto resultTy = getResult().getType();
1074+
1075+
if (!isCompatible(eleTy, resultTy))
1076+
return emitOpError("result type does not match input");
1077+
1078+
for (std::int32_t i : getPosition()) {
1079+
if (auto arrTy = dyn_cast<cc::ArrayType>(eleTy)) {
1080+
if (arrTy.isUnknownSize())
1081+
return emitOpError("array must have constant size");
1082+
if (i < 0 || static_cast<std::int64_t>(i) >= arrTy.getSize())
1083+
return emitOpError("array cannot index out of bounds elements");
1084+
eleTy = arrTy.getElementType();
1085+
} else if (auto strTy = dyn_cast<cc::StructType>(eleTy)) {
1086+
if (i < 0 || static_cast<std::size_t>(i) >= strTy.getMembers().size())
1087+
return emitOpError("struct cannot index out of bounds members");
1088+
eleTy = strTy.getMember(i);
1089+
} else if (auto complexTy = dyn_cast<ComplexType>(eleTy)) {
1090+
if (!(i == 0 || i == 1))
1091+
return emitOpError("complex index is out of bounds");
1092+
eleTy = complexTy.getElementType();
1093+
} else {
1094+
return emitOpError(std::string{"too many indices ("} +
1095+
std::to_string(getPosition().size()) +
1096+
") for the source pointer");
1097+
}
1098+
}
1099+
1100+
Type valTy = getValue().getType();
1101+
if (!isCompatible(valTy, eleTy))
1102+
return emitOpError("value type does not match selected element");
1103+
return success();
1104+
}
1105+
10671106
//===----------------------------------------------------------------------===//
10681107
// StdvecDataOp
10691108
//===----------------------------------------------------------------------===//

python/tests/mlir/ast_elif.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def cost(thetas: np.ndarray): # can pass 1D ndarray or list
4848
# CHECK: %[[VAL_14:.*]] = cc.compute_ptr %[[VAL_13]][%[[VAL_11]]] : (!cc.ptr<!cc.array<f64 x ?>>, i64) -> !cc.ptr<f64>
4949
# CHECK: %[[VAL_15:.*]] = cc.load %[[VAL_14]] : !cc.ptr<f64>
5050
# CHECK: %[[VAL_16:.*]] = cc.compute_ptr %[[VAL_7]]{{\[}}%[[VAL_11]]] : (!cc.ptr<!cc.array<!cc.struct<{i64, f64}> x ?>>, i64) -> !cc.ptr<!cc.struct<{i64, f64}>>
51-
# CHECK: %[[VAL_17:.*]] = cc.insert_value %[[VAL_11]], %[[VAL_12]][0] : (!cc.struct<{i64, f64}>, i64) -> !cc.struct<{i64, f64}>
52-
# CHECK: %[[VAL_18:.*]] = cc.insert_value %[[VAL_15]], %[[VAL_17]][1] : (!cc.struct<{i64, f64}>, f64) -> !cc.struct<{i64, f64}>
51+
# CHECK: %[[VAL_17:.*]] = cc.insert_value %[[VAL_12]][0], %[[VAL_11]] : (!cc.struct<{i64, f64}>, i64) -> !cc.struct<{i64, f64}>
52+
# CHECK: %[[VAL_18:.*]] = cc.insert_value %[[VAL_17]][1], %[[VAL_15]] : (!cc.struct<{i64, f64}>, f64) -> !cc.struct<{i64, f64}>
5353
# CHECK: cc.store %[[VAL_18]], %[[VAL_16]] : !cc.ptr<!cc.struct<{i64, f64}>>
5454
# CHECK: cc.continue %[[VAL_11]] : i64
5555
# CHECK: } step {

python/tests/mlir/ast_list_init.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ def kernel():
5959
# CHECK: %[[VAL_24:.*]] = cc.compute_ptr %[[VAL_23]][%[[VAL_21]]] : (!cc.ptr<!cc.array<f64 x ?>>, i64) -> !cc.ptr<f64>
6060
# CHECK: %[[VAL_25:.*]] = cc.load %[[VAL_24]] : !cc.ptr<f64>
6161
# CHECK: %[[VAL_26:.*]] = cc.compute_ptr %[[VAL_17]][%[[VAL_21]]] : (!cc.ptr<!cc.array<!cc.struct<{i64, f64}> x ?>>, i64) -> !cc.ptr<!cc.struct<{i64, f64}>>
62-
# CHECK: %[[VAL_27:.*]] = cc.insert_value %[[VAL_21]], %[[VAL_22]][0] : (!cc.struct<{i64, f64}>, i64) -> !cc.struct<{i64, f64}>
63-
# CHECK: %[[VAL_28:.*]] = cc.insert_value %[[VAL_25]], %[[VAL_27]][1] : (!cc.struct<{i64, f64}>, f64) -> !cc.struct<{i64, f64}>
62+
# CHECK: %[[VAL_27:.*]] = cc.insert_value %[[VAL_22]][0], %[[VAL_21]] : (!cc.struct<{i64, f64}>, i64) -> !cc.struct<{i64, f64}>
63+
# CHECK: %[[VAL_28:.*]] = cc.insert_value %[[VAL_27]][1], %[[VAL_25]] : (!cc.struct<{i64, f64}>, f64) -> !cc.struct<{i64, f64}>
6464
# CHECK: cc.store %[[VAL_28]], %[[VAL_26]] : !cc.ptr<!cc.struct<{i64, f64}>>
6565
# CHECK: cc.continue %[[VAL_21]] : i64
6666
# CHECK: } step {

python/tests/mlir/ast_list_int.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def oracle(register: cudaq.qview, auxillary_qubit: cudaq.qubit,
4545
# CHECK: %[[VAL_14:.*]] = cc.compute_ptr %[[VAL_13]][%[[VAL_11]]] : (!cc.ptr<!cc.array<i64 x ?>>, i64) -> !cc.ptr<i64>
4646
# CHECK: %[[VAL_15:.*]] = cc.load %[[VAL_14]] : !cc.ptr<i64>
4747
# CHECK: %[[VAL_16:.*]] = cc.compute_ptr %[[VAL_7]]{{\[}}%[[VAL_11]]] : (!cc.ptr<!cc.array<!cc.struct<{i64, i64}> x ?>>, i64) -> !cc.ptr<!cc.struct<{i64, i64}>>
48-
# CHECK: %[[VAL_17:.*]] = cc.insert_value %[[VAL_11]], %[[VAL_12]][0] : (!cc.struct<{i64, i64}>, i64) -> !cc.struct<{i64, i64}>
49-
# CHECK: %[[VAL_18:.*]] = cc.insert_value %[[VAL_15]], %[[VAL_17]][1] : (!cc.struct<{i64, i64}>, i64) -> !cc.struct<{i64, i64}>
48+
# CHECK: %[[VAL_17:.*]] = cc.insert_value %[[VAL_12]][0], %[[VAL_11]] : (!cc.struct<{i64, i64}>, i64) -> !cc.struct<{i64, i64}>
49+
# CHECK: %[[VAL_18:.*]] = cc.insert_value %[[VAL_17]][1], %[[VAL_15]] : (!cc.struct<{i64, i64}>, i64) -> !cc.struct<{i64, i64}>
5050
# CHECK: cc.store %[[VAL_18]], %[[VAL_16]] : !cc.ptr<!cc.struct<{i64, i64}>>
5151
# CHECK: cc.continue %[[VAL_11]] : i64
5252
# CHECK: } step {

python/tests/mlir/ast_qreg_slice.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ def slice():
108108
# CHECK: %[[VAL_39:.*]] = cc.compute_ptr %[[VAL_38]][%[[VAL_36]]] : (!cc.ptr<!cc.array<i64 x ?>>, i64) -> !cc.ptr<i64>
109109
# CHECK: %[[VAL_40:.*]] = cc.load %[[VAL_39]] : !cc.ptr<i64>
110110
# CHECK: %[[VAL_41:.*]] = cc.compute_ptr %[[VAL_32]]{{\[}}%[[VAL_36]]] : (!cc.ptr<!cc.array<!cc.struct<{i64, i64}> x ?>>, i64) -> !cc.ptr<!cc.struct<{i64, i64}>>
111-
# CHECK: %[[VAL_42:.*]] = cc.insert_value %[[VAL_36]], %[[VAL_37]][0] : (!cc.struct<{i64, i64}>, i64) -> !cc.struct<{i64, i64}>
112-
# CHECK: %[[VAL_43:.*]] = cc.insert_value %[[VAL_40]], %[[VAL_42]][1] : (!cc.struct<{i64, i64}>, i64) -> !cc.struct<{i64, i64}>
111+
# CHECK: %[[VAL_42:.*]] = cc.insert_value %[[VAL_37]][0], %[[VAL_36]] : (!cc.struct<{i64, i64}>, i64) -> !cc.struct<{i64, i64}>
112+
# CHECK: %[[VAL_43:.*]] = cc.insert_value %[[VAL_42]][1], %[[VAL_40]] : (!cc.struct<{i64, i64}>, i64) -> !cc.struct<{i64, i64}>
113113
# CHECK: cc.store %[[VAL_43]], %[[VAL_41]] : !cc.ptr<!cc.struct<{i64, i64}>>
114114
# CHECK: cc.continue %[[VAL_36]] : i64
115115
# CHECK: } step {

python/tests/mlir/ghz.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,8 @@ def simple(numQubits: int):
8686
# CHECK: %[[VAL_17:.*]] = cc.undef !cc.struct<{i64, !quake.ref}>
8787
# CHECK: %[[VAL_18:.*]] = quake.extract_ref %[[VAL_10]]{{\[}}%[[VAL_16]]] : (!quake.veq<?>, i64) -> !quake.ref
8888
# CHECK: %[[VAL_19:.*]] = cc.compute_ptr %[[VAL_12]]{{\[}}%[[VAL_16]]] : (!cc.ptr<!cc.array<!cc.struct<{i64, !quake.ref}> x ?>>, i64) -> !cc.ptr<!cc.struct<{i64, !quake.ref}>>
89-
# CHECK: %[[VAL_20:.*]] = cc.insert_value %[[VAL_16]], %[[VAL_17]][0] : (!cc.struct<{i64, !quake.ref}>, i64) -> !cc.struct<{i64, !quake.ref}>
90-
# CHECK: %[[VAL_21:.*]] = cc.insert_value %[[VAL_18]], %[[VAL_20]][1] : (!cc.struct<{i64, !quake.ref}>, !quake.ref) -> !cc.struct<{i64, !quake.ref}>
89+
# CHECK: %[[VAL_20:.*]] = cc.insert_value %[[VAL_17]][0], %[[VAL_16]] : (!cc.struct<{i64, !quake.ref}>, i64) -> !cc.struct<{i64, !quake.ref}>
90+
# CHECK: %[[VAL_21:.*]] = cc.insert_value %[[VAL_20]][1], %[[VAL_18]] : (!cc.struct<{i64, !quake.ref}>, !quake.ref) -> !cc.struct<{i64, !quake.ref}>
9191
# CHECK: cc.store %[[VAL_21]], %[[VAL_19]] : !cc.ptr<!cc.struct<{i64, !quake.ref}>>
9292
# CHECK: cc.continue %[[VAL_16]] : i64
9393
# CHECK: } step {

runtime/test/test_argument_conversion.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,13 @@ void test_aggregates(mlir::MLIRContext *ctx) {
288288
// CHECK-LABEL: cc.arg_subst[0] {
289289
// CHECK: %[[VAL_0:.*]] = cc.undef !cc.struct<{i32, f64, i8, i16}>
290290
// CHECK: %[[VAL_1:.*]] = arith.constant -889275714 : i32
291-
// CHECK: %[[VAL_2:.*]] = cc.insert_value %[[VAL_1]], %[[VAL_0]][0] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
291+
// CHECK: %[[VAL_2:.*]] = cc.insert_value %[[VAL_0]][0], %[[VAL_1]] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
292292
// CHECK: %[[VAL_3:.*]] = arith.constant 87.654499999999998 : f64
293-
// CHECK: %[[VAL_4:.*]] = cc.insert_value %[[VAL_3]], %[[VAL_2]][1] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
293+
// CHECK: %[[VAL_4:.*]] = cc.insert_value %[[VAL_2]][1], %[[VAL_3]] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
294294
// CHECK: %[[VAL_5:.*]] = arith.constant 65 : i8
295-
// CHECK: %[[VAL_6:.*]] = cc.insert_value %[[VAL_5]], %[[VAL_4]][2] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
295+
// CHECK: %[[VAL_6:.*]] = cc.insert_value %[[VAL_4]][2], %[[VAL_5]] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
296296
// CHECK: %[[VAL_7:.*]] = arith.constant -1314 : i16
297-
// CHECK: %[[VAL_8:.*]] = cc.insert_value %[[VAL_7]], %[[VAL_6]][3] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
297+
// CHECK: %[[VAL_8:.*]] = cc.insert_value %[[VAL_6]][3], %[[VAL_7]] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
298298
// CHECK: }
299299
// clang-format on
300300
}
@@ -324,35 +324,35 @@ void test_recursive(mlir::MLIRContext *ctx) {
324324
// CHECK: %[[VAL_0:.*]] = cc.alloca !cc.array<!cc.struct<{i32, f64, i8, i16}> x 3>
325325
// CHECK: %[[VAL_1:.*]] = cc.undef !cc.struct<{i32, f64, i8, i16}>
326326
// CHECK: %[[VAL_2:.*]] = arith.constant -889275714 : i32
327-
// CHECK: %[[VAL_3:.*]] = cc.insert_value %[[VAL_2]], %[[VAL_1]][0] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
327+
// CHECK: %[[VAL_3:.*]] = cc.insert_value %[[VAL_1]][0], %[[VAL_2]] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
328328
// CHECK: %[[VAL_4:.*]] = arith.constant 87.654499999999998 : f64
329-
// CHECK: %[[VAL_5:.*]] = cc.insert_value %[[VAL_4]], %[[VAL_3]][1] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
329+
// CHECK: %[[VAL_5:.*]] = cc.insert_value %[[VAL_3]][1], %[[VAL_4]] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
330330
// CHECK: %[[VAL_6:.*]] = arith.constant 65 : i8
331-
// CHECK: %[[VAL_7:.*]] = cc.insert_value %[[VAL_6]], %[[VAL_5]][2] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
331+
// CHECK: %[[VAL_7:.*]] = cc.insert_value %[[VAL_5]][2], %[[VAL_6]] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
332332
// CHECK: %[[VAL_8:.*]] = arith.constant -1314 : i16
333-
// CHECK: %[[VAL_9:.*]] = cc.insert_value %[[VAL_8]], %[[VAL_7]][3] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
333+
// CHECK: %[[VAL_9:.*]] = cc.insert_value %[[VAL_7]][3], %[[VAL_8]] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
334334
// CHECK: %[[VAL_10:.*]] = cc.compute_ptr %[[VAL_0]][0] : (!cc.ptr<!cc.array<!cc.struct<{i32, f64, i8, i16}> x 3>>) -> !cc.ptr<!cc.struct<{i32, f64, i8, i16}>>
335335
// CHECK: cc.store %[[VAL_9]], %[[VAL_10]] : !cc.ptr<!cc.struct<{i32, f64, i8, i16}>>
336336
// CHECK: %[[VAL_11:.*]] = cc.undef !cc.struct<{i32, f64, i8, i16}>
337337
// CHECK: %[[VAL_12:.*]] = arith.constant 5412 : i32
338-
// CHECK: %[[VAL_13:.*]] = cc.insert_value %[[VAL_12]], %[[VAL_11]][0] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
338+
// CHECK: %[[VAL_13:.*]] = cc.insert_value %[[VAL_11]][0], %[[VAL_12]] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
339339
// CHECK: %[[VAL_14:.*]] = arith.constant 2.389450e+04 : f64
340-
// CHECK: %[[VAL_15:.*]] = cc.insert_value %[[VAL_14]], %[[VAL_13]][1] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
340+
// CHECK: %[[VAL_15:.*]] = cc.insert_value %[[VAL_13]][1], %[[VAL_14]] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
341341
// CHECK: %[[VAL_16:.*]] = arith.constant 66 : i8
342-
// CHECK: %[[VAL_17:.*]] = cc.insert_value %[[VAL_16]], %[[VAL_15]][2] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
342+
// CHECK: %[[VAL_17:.*]] = cc.insert_value %[[VAL_15]][2], %[[VAL_16]] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
343343
// CHECK: %[[VAL_18:.*]] = arith.constant 2778 : i16
344-
// CHECK: %[[VAL_19:.*]] = cc.insert_value %[[VAL_18]], %[[VAL_17]][3] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
344+
// CHECK: %[[VAL_19:.*]] = cc.insert_value %[[VAL_17]][3], %[[VAL_18]] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
345345
// CHECK: %[[VAL_20:.*]] = cc.compute_ptr %[[VAL_0]][1] : (!cc.ptr<!cc.array<!cc.struct<{i32, f64, i8, i16}> x 3>>) -> !cc.ptr<!cc.struct<{i32, f64, i8, i16}>>
346346
// CHECK: cc.store %[[VAL_19]], %[[VAL_20]] : !cc.ptr<!cc.struct<{i32, f64, i8, i16}>>
347347
// CHECK: %[[VAL_21:.*]] = cc.undef !cc.struct<{i32, f64, i8, i16}>
348348
// CHECK: %[[VAL_22:.*]] = arith.constant 90210 : i32
349-
// CHECK: %[[VAL_23:.*]] = cc.insert_value %[[VAL_22]], %[[VAL_21]][0] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
349+
// CHECK: %[[VAL_23:.*]] = cc.insert_value %[[VAL_21]][0], %[[VAL_22]] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
350350
// CHECK: %[[VAL_24:.*]] = arith.constant 782934.78922999999 : f64
351-
// CHECK: %[[VAL_25:.*]] = cc.insert_value %[[VAL_24]], %[[VAL_23]][1] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
351+
// CHECK: %[[VAL_25:.*]] = cc.insert_value %[[VAL_23]][1], %[[VAL_24]] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
352352
// CHECK: %[[VAL_26:.*]] = arith.constant 67 : i8
353-
// CHECK: %[[VAL_27:.*]] = cc.insert_value %[[VAL_26]], %[[VAL_25]][2] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
353+
// CHECK: %[[VAL_27:.*]] = cc.insert_value %[[VAL_25]][2], %[[VAL_26]] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
354354
// CHECK: %[[VAL_28:.*]] = arith.constant 747 : i16
355-
// CHECK: %[[VAL_29:.*]] = cc.insert_value %[[VAL_28]], %[[VAL_27]][3] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
355+
// CHECK: %[[VAL_29:.*]] = cc.insert_value %[[VAL_27]][3], %[[VAL_28]] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
356356
// CHECK: %[[VAL_30:.*]] = cc.compute_ptr %[[VAL_0]][2] : (!cc.ptr<!cc.array<!cc.struct<{i32, f64, i8, i16}> x 3>>) -> !cc.ptr<!cc.struct<{i32, f64, i8, i16}>>
357357
// CHECK: cc.store %[[VAL_29]], %[[VAL_30]] : !cc.ptr<!cc.struct<{i32, f64, i8, i16}>>
358358
// CHECK: %[[VAL_31:.*]] = arith.constant 3 : i64

test/Quake/arg_subst-3.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
cc.arg_subst[0] {
1010
%0 = cc.undef !cc.struct<{i32, f64, i8, i16}>
1111
%c-889275714_i32 = arith.constant -889275714 : i32
12-
%1 = cc.insert_value %c-889275714_i32, %0[0] : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
12+
%1 = cc.insert_value %0[0], %c-889275714_i32 : (!cc.struct<{i32, f64, i8, i16}>, i32) -> !cc.struct<{i32, f64, i8, i16}>
1313
%cst = arith.constant 87.654499999999998 : f64
14-
%2 = cc.insert_value %cst, %1[1] : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
14+
%2 = cc.insert_value %1[1], %cst : (!cc.struct<{i32, f64, i8, i16}>, f64) -> !cc.struct<{i32, f64, i8, i16}>
1515
%c65_i8 = arith.constant 65 : i8
16-
%3 = cc.insert_value %c65_i8, %2[2] : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
16+
%3 = cc.insert_value %2[2], %c65_i8 : (!cc.struct<{i32, f64, i8, i16}>, i8) -> !cc.struct<{i32, f64, i8, i16}>
1717
%c-1314_i16 = arith.constant -1314 : i16
18-
%4 = cc.insert_value %c-1314_i16, %3[3] : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
18+
%4 = cc.insert_value %3[3], %c-1314_i16 : (!cc.struct<{i32, f64, i8, i16}>, i16) -> !cc.struct<{i32, f64, i8, i16}>
1919
}

0 commit comments

Comments
 (0)