This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Use SDISel instead of FISel for calls and TOC-based accesses with PC-Rel
ClosedPublic

Authored by nemanjai on Aug 21 2020, 5:15 AM.

Details

Summary

PC-Relative addressing introduces a fair bit of complexity for correctly eliminating TOC accesses. FastISel does not include any of that handling so we miscompile code with -mcpu=pwr10 -O0 if it includes an external call that FastISel does not handle followed by any of the following:

  • Floating point constant materialization
  • Materialization of a GlobalValue
  • Call that FastISel does handle

This patch switches to SDISel for any of the above.

Diff Detail

Event Timeline

nemanjai created this revision.Aug 21 2020, 5:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 21 2020, 5:15 AM
nemanjai requested review of this revision.Aug 21 2020, 5:16 AM
stefanp accepted this revision as: stefanp.Aug 24 2020, 1:51 PM
stefanp added a subscriber: stefanp.

LGTM

This revision is now accepted and ready to land.Aug 24 2020, 1:51 PM
NeHuang accepted this revision as: NeHuang.Aug 24 2020, 2:16 PM
NeHuang added a subscriber: NeHuang.

LGTM. Only a nit can be addressed while committing the patch.

llvm/lib/Target/PowerPC/PPCFastISel.cpp
1570

nit: if this is a