This is an archive of the discontinued LLVM Phabricator instance.

[InstSimplify][InstCombine] Modify the interface of decomposeBitTestICmp and use it in the InstSimplify
ClosedPublic

Authored by craig.topper on Aug 10 2017, 2:31 PM.

Details

Summary

This addresses a fixme in InstSimplify about using decomposeBitTest.

I've modified the interface a little to return only the APInt version of the mask that InstSimplify needs. InstCombine now has a small wrapper routine to create a Constant out of it. I've also dropped the returning of 0 since InstSimplify doesn't need that. So InstCombine creates a zero constant itself.

I also had to make decomposeBitTest support vectors since InstSimplify needs that.

As InstSimplify can't use something from the Transforms library, I've moved the CmpInstAnalysis code to the Analysis library.

I'm happy to split this up into smaller pieces if that makes review easier.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Aug 10 2017, 2:31 PM
spatel accepted this revision.Aug 14 2017, 10:54 AM

LGTM.

This revision is now accepted and ready to land.Aug 14 2017, 10:54 AM

Wait - this does have a testable change, right? You can check the ult/ugt cases from InstSimplify with this:
http://rise4fun.com/Alive/XAV

This revision was automatically updated to reflect the committed changes.
llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp