Page MenuHomePhabricator

[XCOFF][FastISel] make fast isel can lower general intrinsics
ClosedPublic

Authored by shchenz on Nov 30 2021, 12:55 AM.

Details

Summary

This patch is to make fast isel for 64bit XCOFF have the ability to select general intrinsics which will not be generated as function entry and function descriptor in the final assembly.

This hides some issues in SelectBasicBlock() -> Scheduler->EmitSchedule() for a single debug related intrinsic call, for example DBG_LABEL in D114685 and DBG_VALUE in D114686.

For example, for DBG_VALUE in patch D114686, the DBG_VALUE will be wrongly generated at the end of the function instead of the front like the IR shows, thus later DWARF info generation will miss generating some DWARF info(arguments/local variables) for the inlined subroutine.

We can fix this issue in EmitSchedule of course, but I think for our XCOFF case, the most sensible way is to let fast ISEL can lower these intrinsics calls so that we don't need to use DAG isel for these not well handled debug intrinsic calls in SelectBasicBlock() -> Scheduler->EmitSchedule().

Diff Detail

Event Timeline

shchenz created this revision.Nov 30 2021, 12:55 AM
shchenz requested review of this revision.Nov 30 2021, 12:55 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 30 2021, 12:55 AM
shchenz updated this revision to Diff 390610.Nov 30 2021, 1:02 AM
qiucf added inline comments.Nov 30 2021, 1:16 AM
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
1784
  • In this case, no extra instruction will be really emitted from this intrinsic, but what if it's an intrinsic producing a real function call?
  • Is it necessary to put the check here, not in PPCFastISel::fastSelectInstruction?
llvm/test/CodeGen/PowerPC/debug-label-fast-isel.ll
3

nit: remove top empty line and use llc < %s -mtriple ... | FileCheck ...

nemanjai added inline comments.Nov 30 2021, 3:14 AM
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
1784
  • In this case, no extra instruction will be really emitted from this intrinsic, but what if it's an intrinsic producing a real function call?

I don't think this is an issue since FastISel::selectIntrinsicCall() only handles a fixed list of intrinsics and the rest are handled in FastISel::fastLowerIntrinsicCall() which we don't override.

  • Is it necessary to put the check here, not in PPCFastISel::fastSelectInstruction?

+1
The fact that we have the same check in both places seems odd and problematic. And the fact that we are now diverging with those two checks is even stranger.

shchenz updated this revision to Diff 390869.Nov 30 2021, 5:13 PM
shchenz marked 3 inline comments as done.

address comments

shchenz added inline comments.Nov 30 2021, 5:13 PM
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
1784

I deleted the redundant logic in PPCFastISel::fastSelectInstruction for Instruction::Call. It is exactly the same as the one in the target-independent one. And PowerPC will also use the target-independent ISel.

gentle ping

gentle ping

gentle ping

craig.topper added inline comments.
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
1784

Use isa instead of dyn_cast.

shchenz updated this revision to Diff 398049.Jan 6 2022, 10:32 PM

comment address

qiucf added a comment.Jan 6 2022, 10:36 PM

nit: Rename debug-label-fast-isel.ll to debug-label-fast-isel-xcoff.ll?

nit: Rename debug-label-fast-isel.ll to debug-label-fast-isel-xcoff.ll?

Is this renaming from a public guideline? To me, it should be easy to know that this file is AIX only after checking the file.

qiucf accepted this revision as: qiucf.Jan 6 2022, 11:04 PM

LGTM.

Is this renaming from a public guideline? To me, it should be easy to know that this file is AIX only after checking the file.

Not necessary.

This revision is now accepted and ready to land.Jan 6 2022, 11:04 PM
This revision was automatically updated to reflect the committed changes.