Skip to content

Change c style cast to c++ style cast #2936

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 10, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,8 @@ ZTensor ZTensorHelper::getZTensor(Value preTransformedDescPtr,
ZTensor zTensor;

Type llvmZTensorStructTy = getZTensorStructTy(context);
Value one = create.llvm.constant(rewriter.getI64Type(), (int64_t)1);
Value one =
create.llvm.constant(rewriter.getI64Type(), static_cast<int64_t>(1));
Value alloc =
create.llvm._alloca(krnl::getPointerType(context, llvmZTensorStructTy),
llvmZTensorStructTy, one,
Expand Down
15 changes: 8 additions & 7 deletions src/Accelerators/NNPA/Support/Stickify/Stickify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -977,13 +977,14 @@ zdnn_status transform_ztensor(const void *in_buf, zdnn_ztensor *ztensor) {
fields_to_convert = MIN((ztensor->transformed_desc->dim1 - e1x),
AIU_2BYTE_CELLS_PER_STICK);

nbr_fields_converted =
convert_data_format((void *)((uintptr_t)in_buf + input_offset),
ztensor->pre_transformed_desc->type,
reinterpret_cast<void *>(
reinterpret_cast<uintptr_t>(ztensor->buffer) +
output_offset),
ztensor->transformed_desc->type, fields_to_convert);
nbr_fields_converted = convert_data_format(
reinterpret_cast<void *>(
reinterpret_cast<uintptr_t>(in_buf) + input_offset),
ztensor->pre_transformed_desc->type,
reinterpret_cast<void *>(
reinterpret_cast<uintptr_t>(ztensor->buffer) +
output_offset),
ztensor->transformed_desc->type, fields_to_convert);

if (nbr_fields_converted == 0) {
return ZDNN_CONVERT_FAILURE;
Expand Down
2 changes: 1 addition & 1 deletion src/Conversion/KrnlToLLVM/KrnlEntryPoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ class KrnlEntryPointOpLowering : public OpRewritePattern<KrnlEntryPointOp> {
// Insert size of the dimension.
Value dimSizePtr =
create.llvm.getElemPtr(getPointerType(context, int64Ty), int64Ty,
sizesArrayPtr, ArrayRef<LLVM::GEPArg>{(int32_t)i});
sizesArrayPtr, ArrayRef<LLVM::GEPArg>{static_cast<int32_t>(i)});
Value dimSize = create.llvm.load(int64Ty, dimSizePtr);
memRef = create.llvm.insertValue(memRefTy, memRef, dimSize, {3, i});

Expand Down
2 changes: 1 addition & 1 deletion src/Conversion/KrnlToLLVM/KrnlToLLVMHelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ void fillOMTensorWithMemRef(Value &outMemRef, Type elemTy, Value &outOMTensor,
Value dimStride = create.llvm.extractValue(int64Ty, outMemRef, {4, i});
Value dimStridePtr =
create.llvm.getElemPtr(getPointerType(context, int64Ty), int64Ty,
stridesArrayPtr, ArrayRef<LLVM::GEPArg>{(int32_t)i});
stridesArrayPtr, ArrayRef<LLVM::GEPArg>{static_cast<int32_t>(i)});
create.llvm.store(dimStride, dimStridePtr);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Dialect/Mlir/IndexExprBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ void IndexExprBuilder::getIntFromArrayAsLiterals(
static_cast<uint64_t>(len) <= size && "requesting too many elements");
if (len == 0)
return;
for (uint64_t i = 0; i < (uint64_t)len; ++i) {
for (uint64_t i = 0; i < static_cast<uint64_t>(len); ++i) {
IndexExpr indexExpr = getIntFromArrayAsLiteral(intAttrArray, i);
assert(!indexExpr.isUndefined() && "expected defined index expr");
list.emplace_back(indexExpr);
Expand Down
Loading