Page MenuHomePhabricator

[AArch64] Avoid generating LL/SC for atomicrmw before regalloc at -O0.
AbandonedPublic

Authored by efriedma on Apr 23 2021, 5:54 PM.

Details

Summary

This is a retread of the issue we had in the past with cmpxchg: fast regalloc can generate spills in weird places, so the ll/sc sequence never terminates. To avoid this, don't use the early ll/sc expansion at -O0.

I didn't spend the time to implement individual instructions for each atomicrmw instruction; instead, it's just expanding to the known-good cmpxchg. This is inefficient, but not sure how much we care; we don't use these sequences with LSE or atomic outlining.

Fixes https://bugs.llvm.org/show_bug.cgi?id=48017

Diff Detail

Unit TestsFailed

TimeTest
40 msx64 debian > LLVM.Transforms/AtomicExpand/AArch64::expand-atomicrmw-xchg-fp.ll
Script: -- : 'RUN: at line 2'; /mnt/disks/ssd0/agent/llvm-project/build/bin/opt -S -mtriple=aarch64-- -atomic-expand /mnt/disks/ssd0/agent/llvm-project/llvm/test/Transforms/AtomicExpand/AArch64/expand-atomicrmw-xchg-fp.ll | /mnt/disks/ssd0/agent/llvm-project/build/bin/FileCheck /mnt/disks/ssd0/agent/llvm-project/llvm/test/Transforms/AtomicExpand/AArch64/expand-atomicrmw-xchg-fp.ll
50 msx64 windows > LLVM.Transforms/AtomicExpand/AArch64::expand-atomicrmw-xchg-fp.ll
Script: -- : 'RUN: at line 2'; c:\ws\w16c2-2\llvm-project\premerge-checks\build\bin\opt.exe -S -mtriple=aarch64-- -atomic-expand C:\ws\w16c2-2\llvm-project\premerge-checks\llvm\test\Transforms\AtomicExpand\AArch64\expand-atomicrmw-xchg-fp.ll | c:\ws\w16c2-2\llvm-project\premerge-checks\build\bin\filecheck.exe C:\ws\w16c2-2\llvm-project\premerge-checks\llvm\test\Transforms\AtomicExpand\AArch64\expand-atomicrmw-xchg-fp.ll