Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions clang/include/clang/CIR/Dialect/IR/CIRAttrs.td
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,13 @@ def UndefAttr : CIR_Attr<"Undef", "undef", [TypedAttrInterface]> {
}];

let parameters = (ins AttributeSelfTypeParameter<"">:$type);

let builders = [
AttrBuilderWithInferredContext<(ins "mlir::Type":$type), [{
return $_get(type.getContext(), type);
}]>
];

let assemblyFormat = [{}];
}

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CIR/CodeGen/CIRGenExprConst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ mlir::Attribute ConstantAggregateBuilder::buildFrom(
ConstantAggregateBuilderUtils Utils(CGM);

if (Elems.empty())
return cir::UndefAttr::get(CGM.getBuilder().getContext(), DesiredTy);
return cir::UndefAttr::get(DesiredTy);

auto Offset = [&](size_t I) { return Offsets[I] - StartOffset; };

Expand Down
2 changes: 1 addition & 1 deletion clang/lib/CIR/CodeGen/CIRGenModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1413,7 +1413,7 @@ void CIRGenModule::emitGlobalVarDefinition(const clang::VarDecl *d,
d->getType()->isCUDADeviceBuiltinTextureType());
if (getLangOpts().CUDA &&
(isCudaSharedVar || isCudaShadowVar || isCudaDeviceShadowVar))
init = UndefAttr::get(&getMLIRContext(), convertType(d->getType()));
init = cir::UndefAttr::get(convertType(d->getType()));
else if (d->hasAttr<LoaderUninitializedAttr>())
assert(0 && "not implemented");
else if (!initExpr) {
Expand Down
4 changes: 2 additions & 2 deletions clang/lib/CIR/Dialect/IR/CIRMemorySlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ llvm::SmallVector<MemorySlot> cir::AllocaOp::getPromotableSlots() {

Value cir::AllocaOp::getDefaultValue(const MemorySlot &slot,
OpBuilder &builder) {
return builder.create<cir::ConstantOp>(
getLoc(), slot.elemType, builder.getAttr<cir::UndefAttr>(slot.elemType));
return builder.create<cir::ConstantOp>(getLoc(), slot.elemType,
cir::UndefAttr::get(slot.elemType));
}

void cir::AllocaOp::handleBlockArgument(const MemorySlot &slot,
Expand Down
Loading