This is an archive of the discontinued LLVM Phabricator instance.

clang: Use ptrmask for pointer alignment
ClosedPublic

Authored by arsenm on Jan 30 2023, 1:58 PM.

Details

Summary

Avoid using ptrtoint/inttoptr.

Diff Detail

Event Timeline

arsenm created this revision.Jan 30 2023, 1:58 PM
Herald added a project: Restricted Project. · View Herald TranscriptJan 30 2023, 1:58 PM
arsenm requested review of this revision.Jan 30 2023, 1:58 PM
fhahn added a comment.Jan 31 2023, 7:20 AM

Using ptrmask here looks good to me, but it looks like a couple of tests need still updating;

arsenm updated this revision to Diff 499797.Feb 23 2023, 3:42 AM

Test updates

arsenm updated this revision to Diff 499798.Feb 23 2023, 3:42 AM
arsenm updated this revision to Diff 499799.

The __builtin_align_{up,down} code generation could also make use of this IIRC. I think the reason I didn't do this initially was concerns about ptrmask not being optimized as well.

fhahn accepted this revision.Feb 28 2023, 12:23 PM

LGTM, thanks!

The __builtin_align_{up,down} code generation could also make use of this IIRC. I think the reason I didn't do this initially was concerns about ptrmask not being optimized as well.

Yeah, I think it would probably be good to use the intrinsic and just address the remaining relevant gaps, if there are any.

This revision is now accepted and ready to land.Feb 28 2023, 12:23 PM