This is an archive of the discontinued LLVM Phabricator instance.

[Attributor] Remove function pointer restriction for AAAlign
ClosedPublic

Authored by nikic on Mar 3 2022, 6:44 AM.

Details

Summary

This check is not compatible with opaque pointers. We can avoid it by adjusting the getPointerAlignment() implementation to avoid creating unnecessary ptrtoint expressions for bitcasted pointers. The code already uses OnlyIfReduced to not create an expression if it does not simplify, and this makes sure that folding a bitcast + ptrtoint into a ptrtoint doesn't count as a simplification.

Diff Detail

Event Timeline

nikic created this revision.Mar 3 2022, 6:44 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 3 2022, 6:44 AM
nikic requested review of this revision.Mar 3 2022, 6:44 AM
Herald added a reviewer: sstefan1. · View Herald Transcript
Herald added a reviewer: baziotis. · View Herald Transcript
Herald added a project: Restricted Project. · View Herald Transcript
nikic retitled this revision from [Attribute] Remove function pointer restriction for AAAlign to [Attributor] Remove function pointer restriction for AAAlign.Mar 3 2022, 12:40 PM
jdoerfert accepted this revision.Mar 6 2022, 3:01 PM

Removing this "hack" is a good idea. From the TODO I'd assumed we simply ignore function pointer i2p uses that have no uses themselves. But this seems to work as well I guess, or at least there is no test (yet) to expose it doesn't. LG

This revision is now accepted and ready to land.Mar 6 2022, 3:01 PM
This revision was landed with ongoing or failed builds.Mar 7 2022, 1:03 AM
This revision was automatically updated to reflect the committed changes.