mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-27 13:30:05 +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
34 lines
1.3 KiB
LLVM
34 lines
1.3 KiB
LLVM
; RUN: llc < %s -mtriple=thumbv7-apple-darwin -arm-atomic-cfg-tidy=0 | FileCheck %s
|
|
; RUN: llc < %s -mtriple=thumbv7-apple-darwin -arm-atomic-cfg-tidy=0 -arm-default-it | FileCheck %s
|
|
; RUN: llc < %s -mtriple=thumbv8-apple-darwin -arm-atomic-cfg-tidy=0 -arm-no-restrict-it | FileCheck %s
|
|
|
|
; There shouldn't be a unconditional branch at end of bb52.
|
|
; rdar://7184787
|
|
|
|
@posed = external global i64 ; <i64*> [#uses=1]
|
|
|
|
define i1 @ab_bb52(i64 %.reload78, i64* %.out, i64* %.out1) nounwind {
|
|
newFuncRoot:
|
|
br label %bb52
|
|
|
|
bb52.bb55_crit_edge.exitStub: ; preds = %bb52
|
|
store i64 %0, i64* %.out
|
|
store i64 %2, i64* %.out1
|
|
ret i1 true
|
|
|
|
bb52.bb53_crit_edge.exitStub: ; preds = %bb52
|
|
store i64 %0, i64* %.out
|
|
store i64 %2, i64* %.out1
|
|
ret i1 false
|
|
|
|
bb52: ; preds = %newFuncRoot
|
|
; CHECK: movne
|
|
; CHECK: moveq
|
|
; CHECK: pop
|
|
%0 = load i64* @posed, align 4 ; <i64> [#uses=3]
|
|
%1 = sub i64 %0, %.reload78 ; <i64> [#uses=1]
|
|
%2 = ashr i64 %1, 1 ; <i64> [#uses=3]
|
|
%3 = icmp eq i64 %2, 0 ; <i1> [#uses=1]
|
|
br i1 %3, label %bb52.bb55_crit_edge.exitStub, label %bb52.bb53_crit_edge.exitStub
|
|
}
|