Skip to content

Commit 8dc51ac

Browse files
author
Mike Essenmacher
authored
Change c style cast to c++ style cast (#2936)
Signed-off-by: Mike Essenmacher <[email protected]>
1 parent 0ac3dc9 commit 8dc51ac

File tree

5 files changed

+13
-11
lines changed

5 files changed

+13
-11
lines changed

src/Accelerators/NNPA/Conversion/ZLowToLLVM/ZLowToLLVMCommon.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,8 @@ ZTensor ZTensorHelper::getZTensor(Value preTransformedDescPtr,
248248
ZTensor zTensor;
249249

250250
Type llvmZTensorStructTy = getZTensorStructTy(context);
251-
Value one = create.llvm.constant(rewriter.getI64Type(), (int64_t)1);
251+
Value one =
252+
create.llvm.constant(rewriter.getI64Type(), static_cast<int64_t>(1));
252253
Value alloc =
253254
create.llvm._alloca(krnl::getPointerType(context, llvmZTensorStructTy),
254255
llvmZTensorStructTy, one,

src/Accelerators/NNPA/Support/Stickify/Stickify.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -977,13 +977,14 @@ zdnn_status transform_ztensor(const void *in_buf, zdnn_ztensor *ztensor) {
977977
fields_to_convert = MIN((ztensor->transformed_desc->dim1 - e1x),
978978
AIU_2BYTE_CELLS_PER_STICK);
979979

980-
nbr_fields_converted =
981-
convert_data_format((void *)((uintptr_t)in_buf + input_offset),
982-
ztensor->pre_transformed_desc->type,
983-
reinterpret_cast<void *>(
984-
reinterpret_cast<uintptr_t>(ztensor->buffer) +
985-
output_offset),
986-
ztensor->transformed_desc->type, fields_to_convert);
980+
nbr_fields_converted = convert_data_format(
981+
reinterpret_cast<void *>(
982+
reinterpret_cast<uintptr_t>(in_buf) + input_offset),
983+
ztensor->pre_transformed_desc->type,
984+
reinterpret_cast<void *>(
985+
reinterpret_cast<uintptr_t>(ztensor->buffer) +
986+
output_offset),
987+
ztensor->transformed_desc->type, fields_to_convert);
987988

988989
if (nbr_fields_converted == 0) {
989990
return ZDNN_CONVERT_FAILURE;

src/Conversion/KrnlToLLVM/KrnlEntryPoint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ class KrnlEntryPointOpLowering : public OpRewritePattern<KrnlEntryPointOp> {
377377
// Insert size of the dimension.
378378
Value dimSizePtr =
379379
create.llvm.getElemPtr(getPointerType(context, int64Ty), int64Ty,
380-
sizesArrayPtr, ArrayRef<LLVM::GEPArg>{(int32_t)i});
380+
sizesArrayPtr, ArrayRef<LLVM::GEPArg>{static_cast<int32_t>(i)});
381381
Value dimSize = create.llvm.load(int64Ty, dimSizePtr);
382382
memRef = create.llvm.insertValue(memRefTy, memRef, dimSize, {3, i});
383383

src/Conversion/KrnlToLLVM/KrnlToLLVMHelper.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ void fillOMTensorWithMemRef(Value &outMemRef, Type elemTy, Value &outOMTensor,
183183
Value dimStride = create.llvm.extractValue(int64Ty, outMemRef, {4, i});
184184
Value dimStridePtr =
185185
create.llvm.getElemPtr(getPointerType(context, int64Ty), int64Ty,
186-
stridesArrayPtr, ArrayRef<LLVM::GEPArg>{(int32_t)i});
186+
stridesArrayPtr, ArrayRef<LLVM::GEPArg>{static_cast<int32_t>(i)});
187187
create.llvm.store(dimStride, dimStridePtr);
188188
}
189189
}

src/Dialect/Mlir/IndexExprBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ void IndexExprBuilder::getIntFromArrayAsLiterals(
151151
static_cast<uint64_t>(len) <= size && "requesting too many elements");
152152
if (len == 0)
153153
return;
154-
for (uint64_t i = 0; i < (uint64_t)len; ++i) {
154+
for (uint64_t i = 0; i < static_cast<uint64_t>(len); ++i) {
155155
IndexExpr indexExpr = getIntFromArrayAsLiteral(intAttrArray, i);
156156
assert(!indexExpr.isUndefined() && "expected defined index expr");
157157
list.emplace_back(indexExpr);

0 commit comments

Comments
 (0)