Page MenuHomePhabricator

[RISCV] Emit .variant_cc directives for vector function calls.

Authored by fakepaper56 on Dec 6 2022, 4:19 AM.



The patch is splitted from D103435. The patch emits .variant_cc [0] for those
function calls that have vector arguments or vector return values.


Initial authored by: HsiangKai

Diff Detail

Unit TestsFailed

60,040 msx64 debian > SanitizerCommon-Unit._/Sanitizer-x86_64-Test/42::48
Script(shard): -- GTEST_OUTPUT=json:/var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/lib/sanitizer_common/tests/./Sanitizer-x86_64-Test-SanitizerCommon-Unit-3142879-42-48.json GTEST_SHUFFLE=0 GTEST_TOTAL_SHARDS=48 GTEST_SHARD_INDEX=42 /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/lib/sanitizer_common/tests/./Sanitizer-x86_64-Test
60,070 msx64 debian > libFuzzer.libFuzzer::fuzzer-leak.test
Script: -- : 'RUN: at line 3'; /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/LeakTest.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/fuzzer-leak.test.tmp-LeakTest
60,050 msx64 debian > libFuzzer.libFuzzer::minimize_crash.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/NullDerefTest.cpp -o /var/lib/buildkite-agent/builds/llvm-project/build/projects/compiler-rt/test/fuzzer/X86_64DefaultLinuxConfig/Output/minimize_crash.test.tmp-NullDerefTest

Event Timeline

fakepaper56 created this revision.Dec 6 2022, 4:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 6 2022, 4:19 AM
fakepaper56 requested review of this revision.Dec 6 2022, 4:19 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 6 2022, 4:19 AM

LGTM from the psABI perspective, but I would like to wait another week to make sure other review is happy :)


I am surprise VLS type will set .variant_cc too, but I realized soon that's kind of LLVM ABI extensions.

smd added a subscriber: smd.Dec 9 2022, 12:46 AM
smd added inline comments.

Could this label printing be extended not only for vector calls, but also for functions that has variant_cc flag set?
I guess this is what I need for D132994 to go further.

jrtc27 added inline comments.Dec 9 2022, 12:56 AM

Your code should just be calling emitDirectiveVariantCC, not poking around in the symbol directly. Emitting the directive based on st_other is backwards.

Rebase and ping.

reames accepted this revision.Dec 15 2022, 3:03 PM

There's missing context in the review description which is important. Please add something along the lines of the following.

The currently ratified calling convention in psABI does not support passing vector arguments or return values in registers. LLVM implements a non-standard calling convention for vector arguments and returns. psABI requires that such non-standard calling conventions be tagged w/ .variant_cc.

With that additional context, LGTM.

This revision is now accepted and ready to land.Dec 15 2022, 3:03 PM

Refine commit message. Almost add all reame's description into the the commit message.
Thank reame's suggestion.

This revision was landed with ongoing or failed builds.Dec 15 2022, 9:51 PM
This revision was automatically updated to reflect the committed changes.