diff --git a/flang/lib/Optimizer/CodeGen/CodeGen.cpp b/flang/lib/Optimizer/CodeGen/CodeGen.cpp --- a/flang/lib/Optimizer/CodeGen/CodeGen.cpp +++ b/flang/lib/Optimizer/CodeGen/CodeGen.cpp @@ -163,13 +163,11 @@ mlir::Value getValueFromBox(mlir::Location loc, mlir::Value box, mlir::Type resultTy, mlir::ConversionPatternRewriter &rewriter, - unsigned boxValue) const { + int boxValue) const { if (box.getType().isa()) { auto pty = mlir::LLVM::LLVMPointerType::get(resultTy); auto p = rewriter.create( - loc, pty, box, - llvm::ArrayRef{ - 0, static_cast(boxValue)}); + loc, pty, box, llvm::ArrayRef{0, boxValue}); return rewriter.create(loc, resultTy, p); } return rewriter.create(loc, box, boxValue); @@ -189,7 +187,7 @@ llvm::SmallVector getDimsFromBox(mlir::Location loc, llvm::ArrayRef retTys, - mlir::Value box, unsigned dim, + mlir::Value box, int dim, mlir::ConversionPatternRewriter &rewriter) const { mlir::Value l0 = getDimFieldFromBox(loc, box, dim, 0, retTys[0], rewriter); mlir::Value l1 = getDimFieldFromBox(loc, box, dim, 1, retTys[1], rewriter); @@ -205,19 +203,19 @@ "descriptor inquiry with runtime dim can only be done on descriptor " "in memory"); auto pty = mlir::LLVM::LLVMPointerType::get(ty); - mlir::LLVM::GEPOp p = - genGEP(loc, pty, rewriter, box, 0, kDimsPosInBox, dim, off); + mlir::LLVM::GEPOp p = genGEP(loc, pty, rewriter, box, 0, + static_cast(kDimsPosInBox), dim, off); return rewriter.create(loc, ty, p); } mlir::Value - getDimFieldFromBox(mlir::Location loc, mlir::Value box, unsigned dim, int off, + getDimFieldFromBox(mlir::Location loc, mlir::Value box, int dim, int off, mlir::Type ty, mlir::ConversionPatternRewriter &rewriter) const { if (box.getType().isa()) { auto pty = mlir::LLVM::LLVMPointerType::get(ty); - mlir::LLVM::GEPOp p = - genGEP(loc, pty, rewriter, box, 0, kDimsPosInBox, dim, off); + mlir::LLVM::GEPOp p = genGEP(loc, pty, rewriter, box, 0, + static_cast(kDimsPosInBox), dim, off); return rewriter.create(loc, ty, p); } return rewriter.create(