This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Don't simplify calls without uses
ClosedPublic

Authored by nikic on Mar 7 2020, 12:11 PM.

Details

Summary

When simplifying a call without uses, replaceInstUsesWith() is going to do nothing, but we'll skip all following folds. We can only run into this problem with calls that both simplify and are not trivially dead if unused, which currently seems to happen only with calls to undef, as the test diff shows. When extending SimplifyCall() to handle "returned" attributes, this becomes a much bigger problem, so I'm fixing this first.

Diff Detail

Event Timeline

nikic created this revision.Mar 7 2020, 12:11 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 7 2020, 12:11 PM
lebedev.ri accepted this revision.Mar 9 2020, 6:21 AM

Makes sense to me, but i'm not very familiar with InstCombiner::visitCallInst()

This revision is now accepted and ready to land.Mar 9 2020, 6:21 AM
This revision was automatically updated to reflect the committed changes.