This is an archive of the discontinued LLVM Phabricator instance.

[NFCI][InstCombine] Move store merging from `visitStoreInst()` into `visitUnconditionalBranchInst()`
ClosedPublic

Authored by lebedev.ri on Jul 13 2020, 5:12 AM.

Details

Summary

As @nikic is pointing out in https://bugs.llvm.org/show_bug.cgi?id=46680#c5,
InstCombine should not have forward instruction scans,
so let's move this transform into the proper place.

This is pretty much NFCI.

Diff Detail

Event Timeline

lebedev.ri created this revision.Jul 13 2020, 5:12 AM
nikic added inline comments.Jul 13 2020, 6:58 AM
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
2760

Can we just return &BI; here, and let the usual reprocessing deal with it?

lebedev.ri marked 2 inline comments as done.

If changed, just return BI, let the usual handling deal with it.

llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
2760

.. or did you mean *always* return &BI; ?

nikic added inline comments.Jul 13 2020, 8:30 AM
llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
2760

Yeah, I meant always returning. That will try rerunning this code and will either find the next store to merge and do so, or not.

lebedev.ri marked an inline comment as done.

Addressed comments.

This revision is now accepted and ready to land.Jul 13 2020, 9:12 AM
This revision was automatically updated to reflect the committed changes.