mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-24 22:32:47 +00:00
d0dbe02fd2
The C and C++ semantics for compare_exchange require it to return a bool indicating success. This gets mapped to LLVM IR which follows each cmpxchg with an icmp of the value loaded against the desired value. When lowered to ldxr/stxr loops, this extra comparison is redundant: its results are implicit in the control-flow of the function. This commit makes two changes: it replaces that icmp with appropriate PHI nodes, and then makes sure earlyCSE is called after expansion to actually make use of the opportunities revealed. I've also added -{arm,aarch64}-enable-atomic-tidy options, so that existing fragile tests aren't perturbed too much by the change. Many of them either rely on undef/unreachable too pervasively to be restored to something well-defined (particularly while making sure they test the same obscure assert from many years ago), or depend on a particular CFG shape, which is disrupted by SimplifyCFG. rdar://problem/16227836 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209883 91177308-0d34-0410-b5e6-96231b3b80d8
35 lines
1.2 KiB
LLVM
35 lines
1.2 KiB
LLVM
; RUN: llc -mtriple=thumbv7-apple-darwin10 -arm-atomic-cfg-tidy=0 < %s | FileCheck %s
|
|
|
|
%struct.op = type { %struct.op*, %struct.op*, %struct.op* ()*, i32, i16, i16, i8, i8 }
|
|
|
|
; CHECK: Perl_ck_sort
|
|
; CHECK: ldreq
|
|
; CHECK: moveq [[REGISTER:(r[0-9]+)|(lr)]]
|
|
; CHECK: streq {{(r[0-9])|(lr)}}, {{\[}}[[REGISTER]]{{\]}}, #24
|
|
|
|
define void @Perl_ck_sort() nounwind optsize {
|
|
entry:
|
|
%tmp27 = load %struct.op** undef, align 4
|
|
switch i16 undef, label %if.end151 [
|
|
i16 178, label %if.then60
|
|
i16 177, label %if.then60
|
|
]
|
|
|
|
if.then60: ; preds = %if.then40
|
|
br i1 undef, label %if.then67, label %if.end95
|
|
|
|
if.then67: ; preds = %if.then60
|
|
%op_next71 = getelementptr inbounds %struct.op* %tmp27, i32 0, i32 0
|
|
store %struct.op* %tmp27, %struct.op** %op_next71, align 4
|
|
%0 = getelementptr inbounds %struct.op* %tmp27, i32 1, i32 0
|
|
br label %if.end95
|
|
|
|
if.end95: ; preds = %if.else92, %if.then67
|
|
%.pre-phi = phi %struct.op** [ undef, %if.then60 ], [ %0, %if.then67 ]
|
|
%tmp98 = load %struct.op** %.pre-phi, align 4
|
|
br label %if.end151
|
|
|
|
if.end151: ; preds = %if.end100, %if.end, %entry
|
|
ret void
|
|
}
|