This is an archive of the discontinued LLVM Phabricator instance.

[DAGCombine] Fix splitting indexed loads in ForwardStoreValueToDirectLoad()
ClosedPublic

Authored by nemanjai on Mar 25 2020, 8:26 AM.

Details

Summary

In DAGCombiner::visitLOAD() we perform some checks before breaking up an indexed load. However, we don't do the same checking in ForwardStoreValueToDirectLoad() which can lead to failures later during combining (see: https://bugs.llvm.org/show_bug.cgi?id=45301).

This patch just adds the same checks to this function as well.

Fixes: https://bugs.llvm.org/show_bug.cgi?id=45301

Diff Detail

Event Timeline

nemanjai created this revision.Mar 25 2020, 8:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 25 2020, 8:26 AM

The author of the PR confirms that the patch fixes the problem.
Also, the failing unit tests are not due to this patch.

Please refactor the "HasOTCInc || !MaySplitLoadIndex" condition into a helper function.

amyk added a subscriber: amyk.Mar 26 2020, 4:05 PM
amyk added inline comments.
llvm/test/CodeGen/PowerPC/pr45301.ll
3

Add the options like -ppc-asm-full-reg-names, -ppc-vsr-nums-as-vr to the test case.

Please refactor the "HasOTCInc || !MaySplitLoadIndex" condition into a helper function.

I like this suggestion. Thanks!

nemanjai marked an inline comment as done.Mar 27 2020, 5:02 AM
nemanjai added inline comments.
llvm/test/CodeGen/PowerPC/pr45301.ll
3

The first one, yes. The second one, no because there are no vector registers used.

nemanjai updated this revision to Diff 253096.Mar 27 2020, 6:13 AM

Factored out detection of an opaque target constant index into a static function and updated the test case.

This revision is now accepted and ready to land.Mar 27 2020, 11:28 AM
nemanjai updated this revision to Diff 253181.Mar 27 2020, 11:38 AM

I initially misread the comment from Eli. Fold both splitting-related checks into the new function.

efriedma accepted this revision.Mar 27 2020, 12:19 PM

Oh, that's better. :)

This revision was automatically updated to reflect the committed changes.