Skip to content

Commit 7defbf9

Browse files
committed
[StackProtector] Add test for atomicrmw xchg (NFC)
This is an opt based test because usually AtomicExpand will convert it to an integer atomicrmw first.
1 parent 8635b8e commit 7defbf9

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2+
; RUN: opt -S -mtriple=x86_64-unknown-linux-gnu -passes=stack-protector < %s | FileCheck %s
3+
4+
define void @atomicrmw_xchg(ptr %p) sspstrong {
5+
; CHECK-LABEL: define void @atomicrmw_xchg(
6+
; CHECK-SAME: ptr [[P:%.*]]) #[[ATTR0:[0-9]+]] {
7+
; CHECK-NEXT: [[A:%.*]] = alloca i64, align 8
8+
; CHECK-NEXT: [[TMP1:%.*]] = atomicrmw xchg ptr [[P]], ptr [[A]] acquire, align 8
9+
; CHECK-NEXT: ret void
10+
;
11+
%a = alloca i64
12+
atomicrmw xchg ptr %p, ptr %a acquire
13+
ret void
14+
}

0 commit comments

Comments
 (0)