Skip to content

Commit 02e18ab

Browse files
committed
[CIR][CIRGen] Simplify LLVM IR array initialization for clang CIR
Resolves llvm#1266
1 parent 54d48d8 commit 02e18ab

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

clang/lib/CIR/CodeGen/CIRGenExprAgg.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -465,14 +465,14 @@ void AggExprEmitter::emitArrayInit(Address DestPtr, cir::ArrayType AType,
465465

466466
// Emit the explicit initializers.
467467
for (uint64_t i = 0; i != NumInitElements; ++i) {
468-
if (i == 1)
468+
if (i > 0)
469469
one = CGF.getBuilder().getConstInt(
470-
loc, mlir::cast<cir::IntType>(CGF.PtrDiffTy), 1);
470+
loc, mlir::cast<cir::IntType>(CGF.PtrDiffTy), i);
471471

472472
// Advance to the next element.
473473
if (i > 0) {
474474
element = CGF.getBuilder().create<cir::PtrStrideOp>(
475-
loc, cirElementPtrType, element, one);
475+
loc, cirElementPtrType, begin, one);
476476

477477
// Tell the cleanup that it needs to destroy up to this
478478
// element. TODO: some of these stores can be trivially

0 commit comments

Comments
 (0)