[llvm-bugs] [Bug 50780] New: Spill in LL/SC loop when using fast register allocator
via llvm-bugs
llvm-bugs at lists.llvm.org
Sun Jun 20 19:17:33 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=50780
Bug ID: 50780
Summary: Spill in LL/SC loop when using fast register allocator
Product: libraries
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: Backend: PowerPC
Assignee: unassignedbugs at nondot.org
Reporter: lkail at cn.ibm.com
CC: llvm-bugs at lists.llvm.org, nemanja.i.ibm at gmail.com
For llvm IR from pr25526
```
define {i64, i1} @foo(i64* %addr, i64 %desired, i64 %new) {
%old = cmpxchg i64* %addr, i64 %desired, i64 %new seq_cst seq_cst
ret {i64, i1} %old
}
```
Run with `llc -verify-machineinstrs -mtriple=powerpc64-ibm-aix-xcoff
-regalloc=fast < bug.ll |less`
We got spills in LL/SC loop
```
# %bb.0:
std 5, -24(1) # 8-byte Folded Spill
std 4, -16(1) # 8-byte Folded Spill
std 3, -8(1) # 8-byte Folded Spill
sync
L..BB0_1: # =>This Inner Loop Header: Depth=1
ld 4, -8(1) # 8-byte Folded Reload
ld 3, -16(1) # 8-byte Folded Reload
ldarx 4, 0, 4
cmpd 3, 4
std 4, -32(1) # 8-byte Folded Spill
bne 0, L..BB0_3
# %bb.2: # in Loop: Header=BB0_1 Depth=1
ld 3, -24(1) # 8-byte Folded Reload
ld 4, -8(1) # 8-byte Folded Reload
stdcx. 3, 0, 4
bne 0, L..BB0_1
b L..BB0_4
L..BB0_3:
ld 3, -32(1) # 8-byte Folded Reload
ld 4, -8(1) # 8-byte Folded Reload
stdcx. 3, 0, 4
```
Though it hasn't caused infinite loop yet, the size of granule hasn't specified
in POWER ISA, we should avoid spilling considering implementation of POWER ISA
might vary.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210621/36340fd9/attachment.html>
More information about the llvm-bugs
mailing list