Skip to content

Commit

Permalink
codgen: make the Memory GEP an inbounds GEP (#55107)
Browse files Browse the repository at this point in the history
The Julia memory model is always inbounds for GEP.

This makes the code in #55090
look almost the same as it did before the change. Locally I wasn't able
to reproduce the regression, but given it's vectorized code I suspect it
is backend sensitive.

Fixes #55090

Co-authored-by: Zentrik <[email protected]>
  • Loading branch information
gbaraldi and Zentrik authored Aug 8, 2024
1 parent 32423a8 commit 7e1f0be
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/cgutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4286,9 +4286,8 @@ static jl_cgval_t emit_memoryref(jl_codectx_t &ctx, const jl_cgval_t &ref, jl_cg
ovflw = ctx.builder.CreateICmpUGE(ctx.builder.CreateAdd(offset, mlen), ctx.builder.CreateNUWAdd(mlen, mlen));
}
#endif
//Is this change fine
boffset = ctx.builder.CreateMul(offset, elsz);
newdata = ctx.builder.CreateGEP(getInt8Ty(ctx.builder.getContext()), data, boffset);
newdata = ctx.builder.CreateInBoundsGEP(getInt8Ty(ctx.builder.getContext()), data, boffset);
(void)boffset; // LLVM is very bad at handling GEP with types different from the load
if (bc) {
BasicBlock *failBB, *endBB;
Expand Down

0 comments on commit 7e1f0be

Please sign in to comment.