This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Teach foldSelectICmpAndOr to handle vector splats
ClosedPublic

Authored by craig.topper on Aug 28 2017, 3:33 PM.

Details

Summary

This was pretty close to working already. While I was here I went ahead and passed the ICmpInst pointer from the caller instead of doing a dyn_cast that can never fail.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Aug 28 2017, 3:33 PM
spatel accepted this revision.Aug 28 2017, 5:05 PM

I didn't test it, but I don't see a hasOneUse() check on the cmp, so this might be creating more instructions than we expect. That would be a follow-up change though, so LGTM. See inline for a small potential improvement.

lib/Transforms/InstCombine/InstCombineSelect.cpp
322 ↗(On Diff #112980)

Could use IC->getType() and make this a compound predicate in the first line?

This revision is now accepted and ready to land.Aug 28 2017, 5:05 PM
This revision was automatically updated to reflect the committed changes.