Skip to content

Commit 89ebf73

Browse files
committed
[CIR] Make PoisonAttr use AttrBuilderWithInferredContext
1 parent c5bb67a commit 89ebf73

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

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

+10-3
Original file line numberDiff line numberDiff line change
@@ -261,13 +261,20 @@ def UndefAttr : CIR_Attr<"Undef", "undef", [TypedAttrInterface]> {
261261
//===----------------------------------------------------------------------===//
262262

263263
def PoisonAttr : CIR_Attr<"Poison", "poison", [TypedAttrInterface]> {
264-
let summary = "Represent an poison constant";
264+
let summary = "Represent a typed poison constant";
265265
let description = [{
266-
The PoisonAttr represents an poison constant, corresponding to LLVM's notion
267-
of poison.
266+
The PoisonAttr represents a typed poison constant, corresponding to LLVM's
267+
notion of poison.
268268
}];
269269

270270
let parameters = (ins AttributeSelfTypeParameter<"">:$type);
271+
272+
let builders = [
273+
AttrBuilderWithInferredContext<(ins "mlir::Type":$type), [{
274+
return $_get(type.getContext(), type);
275+
}]>
276+
];
277+
271278
let assemblyFormat = [{}];
272279
}
273280

clang/lib/CIR/CodeGen/CIRGenBuiltinAArch64.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -2201,8 +2201,8 @@ static void vecExtendIntValue(CIRGenFunction &cgf, cir::VectorType argVTy,
22012201
// it before inserting.
22022202
arg = builder.createIntCast(arg, eltTy);
22032203
mlir::Value zero = builder.getConstInt(loc, cgf.SizeTy, 0);
2204-
mlir::Value poison = builder.create<cir::ConstantOp>(
2205-
loc, builder.getAttr<cir::PoisonAttr>(eltTy));
2204+
mlir::Value poison =
2205+
builder.create<cir::ConstantOp>(loc, cir::PoisonAttr::get(eltTy));
22062206
arg = builder.create<cir::VecInsertOp>(
22072207
loc, builder.create<cir::VecSplatOp>(loc, argVTy, poison), arg, zero);
22082208
}

0 commit comments

Comments
 (0)