This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Handle vector compares in foldGEPIcmp()
ClosedPublic

Authored by JesperAntonsson on Sep 19 2018, 6:06 AM.

Diff Detail

Event Timeline

lebedev.ri added inline comments.
lib/Transforms/InstCombine/InstCombineCompares.cpp
978–980

Can't you use Constant::getIntegerValue(I.getType(), ICmpInst::isTrueWhenEqual(Cond))?

JesperAntonsson retitled this revision from [InstCombine] Ignore vector compares in foldGEPIcmp() to [InstCombine] Handle vector compares in foldGEPIcmp().
JesperAntonsson edited the summary of this revision. (Show Details)

Roman Lebedev commented with an elegant way to create varying integer values, so this patch makes use of that. Changed name of patch to reflect that we now handle rather than ignore vector icmps.

lebedev.ri accepted this revision.Sep 19 2018, 6:54 AM

LG with a nit.

lib/Transforms/InstCombine/InstCombineCompares.cpp
976–983

There are all these Constant::get()/ConstantInt::get() overloads that don't require APInt.
Have you checked they aren't sufficient?

This revision is now accepted and ready to land.Sep 19 2018, 6:54 AM

Used an overloaded getter with simpler interface.

This revision was automatically updated to reflect the committed changes.