Skip to content

Commit e069e0e

Browse files
committed
Address code review comments
1 parent e7d093b commit e069e0e

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

clang/lib/CIR/CodeGen/CIRGenExpr.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,7 @@ static mlir::Value emitArraySubscriptPtr(CIRGenFunction &cgf,
283283
mlir::Location beginLoc,
284284
mlir::Location endLoc, mlir::Value ptr,
285285
mlir::Type eltTy, mlir::Value idx,
286-
bool inbounds, bool signedIndices,
287-
bool shouldDecay) {
286+
bool inbounds, bool shouldDecay) {
288287
CIRGenModule &cgm = cgf.getCIRGenModule();
289288
// TODO(cir): LLVM codegen emits in bound gep check here, is there anything
290289
// that would enhance tracking this later in CIR?
@@ -294,11 +293,12 @@ static mlir::Value emitArraySubscriptPtr(CIRGenFunction &cgf,
294293
shouldDecay);
295294
}
296295

297-
static Address
298-
emitArraySubscriptPtr(CIRGenFunction &cgf, mlir::Location beginLoc,
299-
mlir::Location endLoc, Address addr, QualType eltType,
300-
mlir::Value idx, bool inbounds, mlir::Location loc,
301-
bool shouldDecay, QualType *arrayType, const Expr *base) {
296+
static Address emitArraySubscriptPtr(CIRGenFunction &cgf,
297+
mlir::Location beginLoc,
298+
mlir::Location endLoc, Address addr,
299+
QualType eltType, mlir::Value idx,
300+
bool inbounds, mlir::Location loc,
301+
bool shouldDecay) {
302302

303303
// Determine the element size of the statically-sized base. This is
304304
// the thing that the indices are expressed in terms of.
@@ -315,9 +315,9 @@ emitArraySubscriptPtr(CIRGenFunction &cgf, mlir::Location beginLoc,
315315
mlir::Value eltPtr;
316316
const mlir::IntegerAttr index = getConstantIndexOrNull(idx);
317317
if (!index) {
318-
eltPtr = emitArraySubscriptPtr(
319-
cgf, beginLoc, endLoc, addr.getPointer(), addr.getElementType(), idx,
320-
inbounds, idx.getType().isSignlessIntOrIndex(), shouldDecay);
318+
eltPtr = emitArraySubscriptPtr(cgf, beginLoc, endLoc, addr.getPointer(),
319+
addr.getElementType(), idx, inbounds,
320+
shouldDecay);
321321
} else {
322322
cgf.cgm.errorNYI("emitArraySubscriptExpr: Non Constant Index");
323323
}
@@ -363,12 +363,11 @@ CIRGenFunction::emitArraySubscriptExpr(const clang::ArraySubscriptExpr *e) {
363363
arrayLV = emitLValue(array);
364364

365365
// Propagate the alignment from the array itself to the result.
366-
QualType arrayType = array->getType();
367366
const Address addr = emitArraySubscriptPtr(
368367
*this, cgm.getLoc(array->getBeginLoc()), cgm.getLoc(array->getEndLoc()),
369368
arrayLV.getAddress(), e->getType(), idx,
370369
!getLangOpts().isSignedOverflowDefined(), cgm.getLoc(e->getExprLoc()),
371-
/*shouldDecay=*/true, &arrayType, e->getBase());
370+
/*shouldDecay=*/true);
372371

373372
return LValue::makeAddr(addr, e->getType());
374373
}

0 commit comments

Comments
 (0)