Page MenuHomePhabricator

[PATCH 36/38] [noalias] Clang CodeGen for restrict-qualified pointers
Needs ReviewPublic

Authored by jeroen.dobbelaere on Oct 4 2019, 3:28 PM.



This is part of the series started by D68484.

Introduce support for restrict-qualified pointers as local variables,
as member of a struct, arrays of restrict-qualified pointers,
pointers to restrict qualified pointers.

The full support is enabled with '-ffull-restrict'.
Combine it with '-fno-noalias-arguments' to avoid putting the 'noalias'
attribute on restrict pointers used as argument. This combination is
needed to correctly support restrict arguments. It is kept as a separate option,
as in some cases, the stronger noalias attribute semantics result in better code.
(which also means that some analysis passes could still be made smarter).

Note: this is a stable point and tests should run fine with the patches applied up to this point.

Diff Detail

Event Timeline

Herald added a project: Restricted Project. · View Herald TranscriptOct 4 2019, 3:28 PM

Adapt CodeGen to std::vector<int64_t> indices (was std::vector<long long>).
Adapt tests to i64 p.objId (was i32).

erichkeane added inline comments.

Rather than this recursion, could you just unpack it from the CannonTy? So replace 107 with:

Type *CannonTy = getCanonicalType()->getBaseElementTypeUnsafe();

That way this is all unpacked and saves you a recursion.

jeroen.dobbelaere marked an inline comment as done.Oct 10 2019, 2:37 PM
jeroen.dobbelaere added inline comments.

Yes, that seems to work.

jeroen.dobbelaere marked an inline comment as done.Oct 11 2019, 6:21 AM
jeroen.dobbelaere added inline comments.
287 ↗(On Diff #223606)

I plan to move the options into the 'f_group'. These will then become: -fonly-restrict-arguments, -ffull-restrict and -fno-noalias-arguments.
I'll also be adding a '-fno-full-restrict' option, so that we can easily fall back to the legacy behavior when the default is toggled.

jeroen.dobbelaere marked an inline comment as done.Oct 14 2019, 6:34 AM

Speedup 'isRestrictOrContainsRestrictMembers' as hinted by Erich.
Moved options to the 'f_Group' and reworked the logic.

zahiraam added inline comments.

Use of Twine would probably be good here?


Remove the #if /#endif pair.

Use 'Twine', remove #if/#endif.

jeroen.dobbelaere edited the summary of this revision. (Show Details)