This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Prevent legalization loop from promoting SELECT_CC from v4i32 to v4i32
ClosedPublic

Authored by nemanjai on May 13 2020, 5:45 AM.

Details

Summary

As reported in https://bugs.llvm.org/show_bug.cgi?id=45709 we can hit an infinite loop in legalization since we set the legalization action for ISD::SELECT_CC for all fixed length vector types to Promote. Without some different legalization action for the type being promoted to, the legalizer simply loops. Since we don't have patterns to match the node, the right legalization action should be Expand.

Diff Detail

Event Timeline

nemanjai created this revision.May 13 2020, 5:45 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 13 2020, 5:45 AM

I confirmed it fixes the case Piotr Kubaj reported. Thank you!

amyk added a subscriber: amyk.May 21 2020, 3:00 PM
amyk added inline comments.
llvm/test/CodeGen/PowerPC/pr45709.ll
6

This is kind of minor, but it may be good to document about the fix in the test case or give the function a more descriptive name.

stefanp accepted this revision as: stefanp.May 22 2020, 4:56 AM
stefanp added a subscriber: stefanp.

The name of the test is pr45709 which refers to the bug number so I guess anyone interested should look there for the details.
However, I still agree with Amy that adding a description inside the test would be useful since the code in the test is not self explanatory.
Otherwise, LGTM.

llvm/test/CodeGen/PowerPC/pr45709.ll
52

nit:
You can probably remove this comment if all we leave is nounwind.

This revision is now accepted and ready to land.May 22 2020, 4:56 AM
saghir accepted this revision.May 22 2020, 6:57 AM
saghir added a subscriber: saghir.

LGTM other than the nits that Stefan mentioned.

amyk accepted this revision.May 22 2020, 1:26 PM

I meant to approve this when I reviewed earlier. LGTM.

nemanjai updated this revision to Diff 266096.May 25 2020, 6:06 PM

Add description to the test case as requested.

This revision was automatically updated to reflect the committed changes.