2009-10-13 17:39:29 +00:00
|
|
|
; RUN: opt < %s -basicaa -gvn -instcombine -S | grep {ret i32 0}
|
2009-02-04 05:16:46 +00:00
|
|
|
|
|
|
|
@flag0 = internal global i32 zeroinitializer
|
|
|
|
@turn = internal global i32 zeroinitializer
|
|
|
|
|
|
|
|
|
|
|
|
define i32 @main() {
|
|
|
|
%a = load i32* @flag0
|
2009-10-13 17:39:29 +00:00
|
|
|
%b = tail call i32 @llvm.atomic.swap.i32.p0i32(i32* @turn, i32 1)
|
2009-02-04 05:16:46 +00:00
|
|
|
%c = load i32* @flag0
|
2009-10-13 17:39:29 +00:00
|
|
|
%d = sub i32 %a, %c
|
|
|
|
ret i32 %d
|
2009-02-04 05:16:46 +00:00
|
|
|
}
|
|
|
|
|
2010-04-07 22:53:17 +00:00
|
|
|
declare i32 @llvm.atomic.swap.i32.p0i32(i32*, i32) nounwind
|