This is an archive of the discontinued LLVM Phabricator instance.

[M68k] Do not pass llvm::Function reference to M68kCCState
ClosedPublic

Authored by myhsu on Aug 15 2021, 10:17 PM.

Details

Summary

Previously we're passing llvm::Function& into M68kCCState to lower
arguments in fastcc. However, that reference might not be available if
it's a library call and we only need its argument types. Therefore,
now we're simply passing a list of argument llvm::Type-s.

This fixes PR-50752.

The origin bug will only be triggered if we're using fastcc for a libcall. However, M68k is not using
fastcc for any of the libcall, so we never really trigger the bug. Therefore it makes little sense to create
a test that calls a library function using fastcc. And the existing tests already cover cases like normal fastcc
and normal libcall.

Diff Detail

Event Timeline

myhsu created this revision.Aug 15 2021, 10:17 PM
myhsu requested review of this revision.Aug 15 2021, 10:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 15 2021, 10:17 PM
RKSimon accepted this revision.Aug 16 2021, 2:12 AM

Thanks for looking at this!

LGTM, with the clang-format fix and (possibly) the const ref fix.

llvm/lib/Target/M68k/M68kCallingConv.h
41

(semi off topic) - should this be 'const M68kCCState &CCInfo' ?

This revision is now accepted and ready to land.Aug 16 2021, 2:12 AM
myhsu updated this revision to Diff 366754.Aug 16 2021, 3:31 PM
myhsu marked an inline comment as done.

Fixed formatting

This revision was landed with ongoing or failed builds.Aug 16 2021, 3:41 PM
This revision was automatically updated to reflect the committed changes.