This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Remove redundant code from SimplifyUsingDistributiveLaws
ClosedPublic

Authored by craig.topper on Apr 24 2017, 10:18 PM.

Details

Summary

The code I've removed here exists in ExpandBinOp in InstSimplify which we call into before SimplifyUsingDistributiveLaws. The code in InstSimplify looks to have been copied from here.

I verified this code doesn't fire on any lit tests. Not that that proves its definitely dead.

Diff Detail

Repository
rL LLVM

Event Timeline

craig.topper created this revision.Apr 24 2017, 10:18 PM
spatel edited edge metadata.Apr 25 2017, 7:44 AM

LGTM. I was just stepping through a few examples that went down this path, and I couldn't see how these cases could trigger either.

One comment about the naming: I'm not sure if anyone else sees it this way, but when I read "simplifyXXX", I assume that we're not creating new instructions. But that's clearly not true for this function, so maybe it's better to rename it "foldUsingDistributiveLaws" or "combineUsingDistributiveLaws"?

Agree the name should be cahnged. I change that as a separate commit.

We have several functions in InstCombine called simplifyXXX that create new instructions. For example SimplifyBSWAP and SimplifyAssociativeOrCommutative

is this ok to commit?

spatel accepted this revision.Apr 25 2017, 10:56 AM

Yes - just forgot to click the button here in Phab. LGTM.

This revision is now accepted and ready to land.Apr 25 2017, 10:56 AM
This revision was automatically updated to reflect the committed changes.