Page MenuHomePhabricator

[AArch64][GlobalISel] Add support for sret demotion.
ClosedPublic

Authored by aemerson on Jul 4 2022, 4:46 PM.

Details

Summary

To do this, we need to implement a target hook and make a minor change to the call lowering to demote arguments to sret if they can't be handled by calling conventions.

Fixes issue 56295

Diff Detail

Unit TestsFailed

TimeTest
220 msx64 debian > BOLT.runtime/X86::user-func-reorder.c
Script: -- : 'RUN: at line 30'; /usr/bin/clang --target=x86_64-linux -fuse-ld=lld -Wl,--unresolved-symbols=ignore-all -no-pie /var/lib/buildkite-agent/builds/llvm-project/bolt/test/runtime/X86/user-func-reorder.c -o /var/lib/buildkite-agent/builds/llvm-project/build/tools/bolt/test/runtime/X86/Output/user-func-reorder.c.tmp.exe -Wl,-q
60,050 msx64 debian > MLIR.Examples/standalone::test.toy
Script: -- : 'RUN: at line 1'; /usr/bin/cmake /var/lib/buildkite-agent/builds/llvm-project/mlir/examples/standalone -G "Ninja" -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCMAKE_C_COMPILER=/usr/bin/clang -DLLVM_ENABLE_LIBCXX=OFF -DMLIR_DIR=/var/lib/buildkite-agent/builds/llvm-project/build/lib/cmake/mlir -DLLVM_USE_LINKER=lld
2,230 msx64 debian > libFuzzer.libFuzzer::fuzzer-finalstats.test
Script: -- : 'RUN: at line 1'; /var/lib/buildkite-agent/builds/llvm-project/build/./bin/clang --driver-mode=g++ -O2 -gline-tables-only -fsanitize=address,fuzzer -I/var/lib/buildkite-agent/builds/llvm-project/compiler-rt/lib/fuzzer -m64 /var/lib/buildkite-agent/builds/llvm-project/compiler-rt/test/fuzzer/SimpleTest.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/fuzzer-finalstats.test.tmp-SimpleTest

Event Timeline

aemerson created this revision.Jul 4 2022, 4:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 4 2022, 4:46 PM
aemerson requested review of this revision.Jul 4 2022, 4:46 PM
Allen added a subscriber: Allen.Jul 4 2022, 7:19 PM
arsenm added inline comments.Jul 5 2022, 7:26 AM
llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-sret-demotion.ll
46

Should also add another function to test the caller side sret

aemerson added inline comments.Jul 5 2022, 10:34 AM
llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-sret-demotion.ll
46

Good point, it only worked before in the runtime test because of a fallback...

paquette added inline comments.Jul 5 2022, 11:08 AM
llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-sret-demotion.ll
43

Does this have to be 9 x i64 or could it be smaller? Would be nice to have fewer generated lines if possible.

aemerson added inline comments.Jul 5 2022, 1:34 PM
llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-sret-demotion.ll
43

It has to be [9 x i64] for it to be returned using sret.

aemerson updated this revision to Diff 442387.Jul 5 2022, 1:34 PM

Fix support on the return lowering side.

arsenm added inline comments.Jul 5 2022, 1:50 PM
llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-sret-demotion.ll
80

Might also be worth adding a case using a tail call

aemerson updated this revision to Diff 442394.Jul 5 2022, 2:00 PM

I'm assuming you mean adding tail to the call?

arsenm accepted this revision.Jul 5 2022, 2:41 PM
This revision is now accepted and ready to land.Jul 5 2022, 2:41 PM
This revision was landed with ongoing or failed builds.Jul 5 2022, 3:24 PM
This revision was automatically updated to reflect the committed changes.