This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Make folding (X >s -1) ? C1 : C2 --> ((X >>s 31) & (C2 - C1)) + C1 support splat vectors
ClosedPublic

Authored by craig.topper on Aug 15 2017, 10:52 PM.

Details

Summary

This reuses decomposeBitTestICmp to decode the compare.

I'm assuming that pointer icmps will never match decomposeBitTestICmp because we shouldn't be doing relational comparisons on points, I think? So I removed the IntegerType check, but I could be wrong.

I've deferred the equality check on the type of compare vs the select until after the decomposeBitTestICmp call because I've considering putting an m_Trunc test inside of decomposeBitTestICmp so X won't always just be the CmpLHS.

Diff Detail

Event Timeline

craig.topper created this revision.Aug 15 2017, 10:52 PM

Added back the type checks and added an explicit truncate test. We don't want to look through a truncate here. Even if decomposeBitTestICmp starts looking through truncates, we need to prevent is for this usage.

spatel accepted this revision.Aug 16 2017, 1:43 PM

LGTM.

This revision is now accepted and ready to land.Aug 16 2017, 1:43 PM
This revision was automatically updated to reflect the committed changes.