Skip to content

Commit 1964539

Browse files
committed
Rename VecTernaryOp operands to mirror AST representation
1 parent c232240 commit 1964539

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

clang/include/clang/CIR/Dialect/IR/CIROps.td

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2199,7 +2199,7 @@ def VecShuffleDynamicOp : CIR_Op<"vec.shuffle.dynamic",
21992199
//===----------------------------------------------------------------------===//
22002200

22012201
def VecTernaryOp : CIR_Op<"vec.ternary",
2202-
[Pure, AllTypesMatch<["result", "vec1", "vec2"]>]> {
2202+
[Pure, AllTypesMatch<["result", "lhs", "rhs"]>]> {
22032203
let summary = "The `cond ? a : b` ternary operator for vector types";
22042204
let description = [{
22052205
The `cir.vec.ternary` operation represents the C/C++ ternary operator,
@@ -2218,14 +2218,14 @@ def VecTernaryOp : CIR_Op<"vec.ternary",
22182218

22192219
let arguments = (ins
22202220
CIR_VectorOfIntType:$cond,
2221-
CIR_VectorType:$vec1,
2222-
CIR_VectorType:$vec2
2221+
CIR_VectorType:$lhs,
2222+
CIR_VectorType:$rhs
22232223
);
22242224

22252225
let results = (outs CIR_VectorType:$result);
22262226
let assemblyFormat = [{
2227-
`(` $cond `,` $vec1 `,` $vec2 `)` `:` qualified(type($cond)) `,`
2228-
qualified(type($vec1)) attr-dict
2227+
`(` $cond `,` $lhs`,` $rhs `)` `:` qualified(type($cond)) `,`
2228+
qualified(type($lhs)) attr-dict
22292229
}];
22302230
let hasVerifier = 1;
22312231
}

clang/lib/CIR/Dialect/IR/CIRDialect.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1598,10 +1598,10 @@ LogicalResult cir::VecTernaryOp::verify() {
15981598
// other operands. (The automatic verification already checked that all
15991599
// operands are vector types and that the second and third operands are the
16001600
// same type.)
1601-
if (getCond().getType().getSize() != getVec1().getType().getSize()) {
1601+
if (getCond().getType().getSize() != getLhs().getType().getSize()) {
16021602
return emitOpError() << ": the number of elements in "
1603-
<< getCond().getType() << " and "
1604-
<< getVec1().getType() << " don't match";
1603+
<< getCond().getType() << " and " << getLhs().getType()
1604+
<< " don't match";
16051605
}
16061606
return success();
16071607
}

clang/lib/CIR/Lowering/DirectToLLVM/LowerToLLVM.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1945,7 +1945,7 @@ mlir::LogicalResult CIRToLLVMVecTernaryOpLowering::matchAndRewrite(
19451945
op.getCond().getLoc(),
19461946
typeConverter->convertType(op.getCond().getType())));
19471947
rewriter.replaceOpWithNewOp<mlir::LLVM::SelectOp>(
1948-
op, bitVec, adaptor.getVec1(), adaptor.getVec2());
1948+
op, bitVec, adaptor.getLhs(), adaptor.getRhs());
19491949
return mlir::success();
19501950
}
19511951

0 commit comments

Comments
 (0)