Skip to content

Commit

Permalink
Add constant index to load_place
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianGCalderon committed Apr 26, 2024
1 parent 31f70a2 commit f800fd3
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion crates/concrete_codegen_mlir/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,23 @@ fn compile_load_place<'c: 'b, 'b>(
.result(0)?
.into();
}
PlaceElem::ConstantIndex(_) => todo!(),
PlaceElem::ConstantIndex(index) => {
local_ty = match local_ty.kind {
TyKind::Array(inner, _) => *inner,
_ => unreachable!(),
};
ptr = block
.append_operation(llvm::get_element_ptr(
ctx.context(),
ptr,
DenseI32ArrayAttribute::new(ctx.context(), &[(*index).try_into().unwrap()]),
compile_type(ctx.module_ctx, &local_ty),
opaque_pointer(ctx.context()),
Location::unknown(ctx.context()),
))
.result(0)?
.into();
}
}
}

Expand Down

0 comments on commit f800fd3

Please sign in to comment.