1 ; RUN: opt < %s -basicaa -gvn -instcombine -S | grep {ret i32 0} 2 3 @flag0 = internal global i32 zeroinitializer 4 @turn = internal global i32 zeroinitializer 5 6 7 define i32 @main() { 8 %a = load i32* @flag0 9 %b = atomicrmw xchg i32* @turn, i32 1 monotonic 10 %c = load i32* @flag0 11 %d = sub i32 %a, %c 12 ret i32 %d 13 } 14