Skip to content
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

Mark most GEPs inbounds and add additional param attributes #1232

Merged
merged 2 commits into from Dec 30, 2015

Conversation

kinke
Copy link
Member

@kinke kinke commented Dec 13, 2015

No description provided.

@@ -531,7 +531,7 @@ bool DtoLowerMagicIntrinsic(IRState *p, FuncDeclaration *fndecl, CallExp *e,
assert(bitmask == 31 || bitmask == 63);
// auto q = cast(size_t*)ptr + (bitnum >> (64bit ? 6 : 5));
LLValue *q = DtoBitCast(ptr, DtoSize_t()->getPointerTo());
q = DtoGEP1(q, p->ir->CreateLShr(bitnum, bitmask == 63 ? 6 : 5), "bitop.q");
q = DtoGEP1(q, p->ir->CreateLShr(bitnum, bitmask == 63 ? 6 : 5), true, "bitop.q");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this being a legal inbounds.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intended semantics for the intrinsics are not really defined in any detail in the upstream docs, but I guess it should be fine.

@kinke
Copy link
Member Author

kinke commented Dec 14, 2015

The 2nd commit adds nonnull attributes for the this/nestedContext implicit params, and dereferenceable<N> (incl. implicit nonnull) for D ref/out params.

} else if (!passPointer) {
} else if (passPointer) {
// ref/out
attrs.addDereferenceable(loweredDType->size());
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getTypeAllocSize(DtoType(loweredDType)) doesn't work here as some LL types seem opaque (forward-declared).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's strange, but I guess we'll roll with it for now.

@kinke kinke changed the title Revise DtoGEP() helpers and mark most GEPs inbounds Mark most GEPs inbounds and add additional param attributes Dec 14, 2015
dnadlinger added a commit that referenced this pull request Dec 30, 2015
Mark most GEPs `inbounds` and add additional param attributes
@dnadlinger dnadlinger merged commit e24eb34 into ldc-developers:master Dec 30, 2015
@kinke kinke deleted the gep branch August 24, 2017 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants