Skip to content

Commit

Permalink
[CIRCodeGen] Simplify LLVM IR array initialization for clang CIR
Browse files Browse the repository at this point in the history
Resolves llvm#1266
  • Loading branch information
Rajveer100 committed Jan 13, 2025
1 parent 54d48d8 commit 1dfbb50
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions clang/lib/CIR/CodeGen/CIRGenExprAgg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,14 +465,14 @@ void AggExprEmitter::emitArrayInit(Address DestPtr, cir::ArrayType AType,

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

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

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

0 comments on commit 1dfbb50

Please sign in to comment.