-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[NativeAOT-LLVM] For TARGET_WASM do not expand to GT_INDEX_ADDR #1824
Conversation
cc @SingleAccretion (had @ in the wrong place) |
src/coreclr/jit/llvm.cpp
Outdated
void Llvm::buildIndexAddr(GenTreeIndexAddr* indexAddr) | ||
{ | ||
Value* firstElementAddr = | ||
_builder.CreateGEP(getGenTreeValue(indexAddr->gtGetOp1()), _builder.getInt32(indexAddr->gtElemOffset)); | ||
Value* offset = _builder.CreateMul(_builder.getInt32(indexAddr->gtElemSize), getGenTreeValue(indexAddr->Index())); | ||
|
||
mapGenTreeToValue(indexAddr, _builder.CreateGEP(firstElementAddr, offset)); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, this won't work as-is, INDEX_ADDR
is effectively bounds-checked (and we're missing the bounds check).
I think it would be better to just always fully expand INDEX
in morph for LLVM, INDEX_ADDR
's only purpose is to increase throughput under MinOpts, and I think that sort of tuning can wait (and is probably not worthwhile anyway).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see you've got a PR in runtime around this area. Would you prefer this was left until that was accepted and merged here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think there is a need to block this change on my changes in the runtime.
The fix here should be very simple: #ifdef
-out the logic that creates INDEX_ADDR
s for TARGET_WASM
in fgMorphArrayIndex
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, have #if'ed it out.
This PR adds support in the LLVM clrjit for the
GT_INDEX_ADDR
instruction. Do I need some todo's in here for 64 bit Wasm on either the index, the element offset (unlikely I suppose, its just the type + length I think), or the element size?@cc SingleAccretion.
Thanks,