Page MenuHomePhabricator

AArch64: support @llvm.{return,frame}address in GlobalISel
ClosedPublic

Authored by t.p.northover on Aug 2 2019, 6:55 AM.

Details

Summary

These intrinsics expand to a variable number of instructions so just like in ISelLowering.cpp we use custom code to deal with them.

Diff Detail

Event Timeline

t.p.northover created this revision.Aug 2 2019, 6:55 AM
aemerson accepted this revision.Aug 2 2019, 10:50 AM

LGTM with test nit.

llvm/test/CodeGen/AArch64/GlobalISel/select-frameaddr.ll
2

If you're going to use an llc test can you add -global-isel-abort=1 -verify-machineinstrs too.

This revision is now accepted and ready to land.Aug 2 2019, 10:50 AM
aemerson added inline comments.Aug 2 2019, 10:54 AM
llvm/test/CodeGen/AArch64/GlobalISel/select-frameaddr.ll
2

s/llc/.ll

arsenm added a subscriber: arsenm.Aug 2 2019, 9:12 PM
arsenm added inline comments.
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
4134

Should backends be directly consuming intrinsics like this? I would expect these to be lowered earlier, and select to never deal with a generic intrinsic

aemerson added inline comments.Aug 2 2019, 10:30 PM
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
4134

What else could these be lowered to?

t.p.northover marked an inline comment as done.Aug 5 2019, 7:20 AM
t.p.northover added inline comments.
llvm/lib/Target/AArch64/AArch64InstructionSelector.cpp
4134

You could probably just about expand everything in terms of @llvm.frameaddress(i32 0), but it would be pretty target-specific and not terribly efficient for @llvm.returnaddress(i32 0).

Ping. Can we get this in?

This revision was automatically updated to reflect the committed changes.
This revision is now accepted and ready to land.Wed, Jan 15, 4:40 AM
RKSimon requested changes to this revision.Wed, Jan 15, 4:42 AM
This revision now requires changes to proceed.Wed, Jan 15, 4:42 AM
This revision is now accepted and ready to land.Wed, Jan 15, 10:23 AM
aemerson closed this revision.Wed, Jan 15, 10:23 AM

Re-closing.

Apologies I've bisected an AArch64 sanitiser buildbot failure down to revision 2e39ea726e9cee20060892705164760229e0cb0b
Revert "Revert rG6078f2fedcac5797ac39ee5ef3fd7a35ef1202d5 - "[AArch64][GlobalISel]: Support @llvm.{return,frame}address selection.""
This first started failing http://lab.llvm.org:8011/builders/clang-cmake-aarch64-lld/builds/8015 with fail mails likely suppressed due to a previous failing build.

When I run the test manually I get the output:

UNCHANGED 'abcdef'
EMPTY ''
PARTIAL '0x4c3'
FIRST_FORMAT 0x4c3694  (/home/peter.smith/llvm/repos/builda64/projects/compiler-rt/test/sanitizer_common/asan-a
SECOND_FORMAT FUNC:<null> LINE:0 FILE:<null>
LONG_FORMAT LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
GLOBAL: <null> <null>:0

Where the <null> LINE:0: File:<null> are supposed to be // CHECK: SECOND_FORMAT FUNC:main LINE:[[@LINE+1]] FILE:symbolize_pc.cpp
It looks like the symboliser is no longer able to find the function.
The test is run at -O0 so this will get global-isel on AArch64.

Can you take a look?

Re-closing.

Apologies I've bisected an AArch64 sanitiser buildbot failure down to revision 2e39ea726e9cee20060892705164760229e0cb0b
Revert "Revert rG6078f2fedcac5797ac39ee5ef3fd7a35ef1202d5 - "[AArch64][GlobalISel]: Support @llvm.{return,frame}address selection.""
This first started failing http://lab.llvm.org:8011/builders/clang-cmake-aarch64-lld/builds/8015 with fail mails likely suppressed due to a previous failing build.

When I run the test manually I get the output:

UNCHANGED 'abcdef'
EMPTY ''
PARTIAL '0x4c3'
FIRST_FORMAT 0x4c3694  (/home/peter.smith/llvm/repos/builda64/projects/compiler-rt/test/sanitizer_common/asan-a
SECOND_FORMAT FUNC:<null> LINE:0 FILE:<null>
LONG_FORMAT LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
GLOBAL: <null> <null>:0

Where the <null> LINE:0: File:<null> are supposed to be // CHECK: SECOND_FORMAT FUNC:main LINE:[[@LINE+1]] FILE:symbolize_pc.cpp
It looks like the symboliser is no longer able to find the function.
The test is run at -O0 so this will get global-isel on AArch64.

Can you take a look?

Sorry, I missed this email. I'll take a look and do a quick fix if I can (don't have access to a linux machine) or revert if it'll take longer.

Re-closing.

Apologies I've bisected an AArch64 sanitiser buildbot failure down to revision 2e39ea726e9cee20060892705164760229e0cb0b
Revert "Revert rG6078f2fedcac5797ac39ee5ef3fd7a35ef1202d5 - "[AArch64][GlobalISel]: Support @llvm.{return,frame}address selection.""
This first started failing http://lab.llvm.org:8011/builders/clang-cmake-aarch64-lld/builds/8015 with fail mails likely suppressed due to a previous failing build.

When I run the test manually I get the output:

UNCHANGED 'abcdef'
EMPTY ''
PARTIAL '0x4c3'
FIRST_FORMAT 0x4c3694  (/home/peter.smith/llvm/repos/builda64/projects/compiler-rt/test/sanitizer_common/asan-a
SECOND_FORMAT FUNC:<null> LINE:0 FILE:<null>
LONG_FORMAT LOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
GLOBAL: <null> <null>:0

Where the <null> LINE:0: File:<null> are supposed to be // CHECK: SECOND_FORMAT FUNC:main LINE:[[@LINE+1]] FILE:symbolize_pc.cpp
It looks like the symboliser is no longer able to find the function.
The test is run at -O0 so this will get global-isel on AArch64.

Can you take a look?

I've committed 2e25d75aaa2 which should hopefully fix it.