This is an archive of the discontinued LLVM Phabricator instance.

[ValueTracking] teach computeKnownBits that a fabs() clears sign bits
ClosedPublic

Authored by spatel on Sep 28 2015, 12:19 PM.

Details

Summary

This was requested in D13076: if we're going to canonicalize to fabs(), ValueTracking should know that fabs() clears sign bits.

In this patch (as in D13076), we're not handling vectors yet even though computeKnownBits' fabs() case itself should be vector-ready via the splat. Fixing this will require follow-on patches that correct logic that uses 'getScalarType'.

Diff Detail

Event Timeline

spatel updated this revision to Diff 35897.Sep 28 2015, 12:19 PM
spatel retitled this revision from to [ValueTracking] teach computeKnownBits that a fabs() clears sign bits.
spatel updated this object.
spatel added reviewers: sanjoy, hfinkel, ab, majnemer.
spatel added a subscriber: llvm-commits.
majnemer accepted this revision.Oct 8 2015, 9:39 AM
majnemer edited edge metadata.

LGTM

This revision is now accepted and ready to land.Oct 8 2015, 9:39 AM
This revision was automatically updated to reflect the committed changes.
arsenm added a subscriber: arsenm.Oct 8 2015, 10:29 AM

Should this also be done in DAGCombiner?

Should this also be done in DAGCombiner?

Sure - I would think that anything that's being done in ValueTracking should be done there too. Can this be refactored, so we're not duplicating code?

Should this also be done in DAGCombiner?

Sure - I would think that anything that's being done in ValueTracking should be done there too. Can this be refactored, so we're not duplicating code?

Not really. The IR and DAG APIs are pretty different. All of this similar logic is already duplicated