This is an archive of the discontinued LLVM Phabricator instance.

Allow calls with known writes when trying to remove allocas [part 2]
ClosedPublic

Authored by reames on Dec 16 2021, 12:37 PM.

Details

Summary

This is a slight generalization of D115829. I noticed this while restructuring code for a follow up patch to perform the same optimizations in DSE.

If we have a call whose only visible effect is writing to an alloca, and we're removing the alloca anyways, we don't care if the call also reads from the same alloca. That read will be unobservable and thus doesn't block removal of the call.

Worth noting is that this observation generalizes for non-argument reads. It just happens that case reduces to a readonly call, and is already handled separately.

Diff Detail

Event Timeline

reames created this revision.Dec 16 2021, 12:37 PM
reames requested review of this revision.Dec 16 2021, 12:37 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 16 2021, 12:37 PM
anna accepted this revision.Dec 16 2021, 12:53 PM

Good catch!

This revision is now accepted and ready to land.Dec 16 2021, 12:53 PM
This revision was landed with ongoing or failed builds.Dec 16 2021, 1:13 PM
This revision was automatically updated to reflect the committed changes.