Page MenuHomePhabricator

[BPI] Look through bitcasts in calcZeroHeuristic

Authored by samparker on Feb 13 2019, 12:21 AM.



Constant hoisting may have hidden a constant behind a bitcast so that it isn't folded into its users. However, this prevents BPI from calculating some of its heuristics that are based upon constant values. So, I've added a simple helper function to look through these casts.

Diff Detail


Event Timeline

samparker created this revision.Feb 13 2019, 12:21 AM
john.brawn accepted this revision.Feb 15 2019, 3:39 AM

LGTM. Looking at it it does make me wonder if we should handle things that aren't ConstantInt, e.g.

bitcast <2 x i16> <i16 0, i16 0> to i32

is still zero, though I'm guessing things like this actually probably never happen and this commit is fine as it is anyway.

This revision is now accepted and ready to land.Feb 15 2019, 3:39 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2019, 3:50 AM