This is an archive of the discontinued LLVM Phabricator instance.

[GlobalISel] Don't combine instructions which are fed by memory instructions.
ClosedPublic

Authored by paquette on May 15 2020, 5:44 PM.

Details

Summary

If we have a memory instruction (e.g. a load), we shouldn't combine it away in some trivial combine.

It's possible that, say, a call lives between the instructions. This could modify the value loaded, making the load instructions not safe to fold.

Diff Detail

Event Timeline

paquette created this revision.May 15 2020, 5:44 PM
Herald added a project: Restricted Project. · View Herald TranscriptMay 15 2020, 5:44 PM
arsenm added inline comments.May 15 2020, 6:24 PM
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
1553

Could also consider if the load is invariant

arsenm added inline comments.May 15 2020, 6:26 PM
llvm/lib/CodeGen/GlobalISel/CombinerHelper.cpp
1553

Something like == G_LOAD && isDereferenceableInvariantLoad?

paquette updated this revision to Diff 266364.May 26 2020, 3:54 PM

Add case for dereferenceable invariant loads

aemerson accepted this revision.May 26 2020, 5:16 PM

LGTM.

This revision is now accepted and ready to land.May 26 2020, 5:16 PM
This revision was automatically updated to reflect the committed changes.