Skip to content

Commit

Permalink
codgen: make the Memory GEP an inbounds GEP (JuliaLang#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 JuliaLang#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 JuliaLang#55090

Co-authored-by: Zentrik <Zentrik@users.noreply.github.com>
  • Loading branch information
2 people authored and lazarusA committed Aug 17, 2024
1 parent 814f35f commit f78abf5
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 f78abf5

Please sign in to comment.