Page MenuHomePhabricator

[X86] Fold load with tail call more aggressively
Needs ReviewPublic

Authored by mejedi on May 2 2021, 2:11 AM.

Details

Summary

Enable folding for tail calls with multiple arguments.

Fixes bugzilla issue 50042.

Diff Detail

Event Timeline

mejedi created this revision.May 2 2021, 2:11 AM
mejedi requested review of this revision.May 2 2021, 2:11 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 2 2021, 2:11 AM
mejedi added inline comments.May 2 2021, 2:31 AM
llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
1209

This part I'm least happy about. It was copied verbatim from X86InstrCompiler.td (X86tcret_6regs).

TBH, I don't fully understand the implications of moving LOAD close to TC_RETURN. It looks safe. However, if this check is omitted, we can end up moving the LOAD and not folding it. This is causing malformed DAG during scheduling in test/CodeGen/X86/musttail-varargs.ll, can't figure why.

I don't find any problem in the tests. So I think it looks good. But I'm not familiar with call lowering, I'd like others to sign off.

llvm/test/CodeGen/X86/sibcall-4.ll
7

Nit: This change is confusing. Maybe better to check all assemblys, or to use update_llc_test_checks.py to generate it.