Page MenuHomePhabricator

[IR] Do not assume that function pointers are aligned

Authored by miyuki on Apr 26 2018, 2:43 AM.



The value tracking analysis uses function alignment to infer that the
least significant bits of function pointers are known to be zero.
Unfortunately, this is not correct for ARM targets: the least
significant bit of a function pointer stores the ARM/Thumb state
information (i.e., the LSB is set for Thumb functions and cleared for
ARM functions).

The original approach ( introduced a
new field for function pointer alignment in the DataLayout structure
to address this. But it seems unlikely that optimizations based on
function pointer alignment would bring much benefit in practice to
justify the additional maintenance burden, so this patch simply
assumes that function pointer alignment is always unknown.

Diff Detail


Event Timeline

miyuki created this revision.Apr 26 2018, 2:43 AM
rogfer01 edited reviewers, added: efriedma; removed: eli.friedman.Apr 26 2018, 2:44 AM
javed.absar added inline comments.Apr 26 2018, 6:27 AM
688 ↗(On Diff #144085)

Maybe a good idea to comment this change a bit

miyuki updated this revision to Diff 144147.Apr 26 2018, 10:03 AM

Added a comment

miyuki marked an inline comment as done.Apr 26 2018, 10:03 AM
This revision is now accepted and ready to land.Apr 26 2018, 11:37 AM
This revision was automatically updated to reflect the committed changes.