[LoongArch] Fix the assertion for atomic store with 'ptr' type
[llvm-project.git] / llvm / test / Transforms / FunctionAttrs / out-of-bounds-iterator-bug.ll
blob6209ddc8317e864212005670102ae3695e771f13
1 ; RUN: opt -passes=function-attrs -S < %s | FileCheck %s
3 ; This checks for a previously existing iterator wraparound bug in
4 ; FunctionAttrs, and in the process covers corner cases with varargs.
6 declare void @llvm.va_start(ptr)
7 declare void @llvm.va_end(ptr)
9 define void @va_func(ptr readonly %b, ...) readonly nounwind {
10 ; CHECK-LABEL: define void @va_func(ptr nocapture readonly %b, ...)
11  entry:
12   %valist = alloca i8
13   call void @llvm.va_start(ptr %valist)
14   call void @llvm.va_end(ptr %valist)
15   %x = call i32 @caller(ptr %b)
16   ret void
19 define i32 @caller(ptr %x) {
20 ; CHECK-LABEL: define noundef i32 @caller(ptr nocapture readonly %x)
21  entry:
22   call void(ptr,...) @va_func(ptr null, i32 0, i32 0, i32 0, ptr %x)
23   ret i32 42
26 define void @va_func2(ptr readonly %b, ...) {
27 ; CHECK-LABEL: define void @va_func2(ptr nocapture readonly %b, ...)
28  entry:
29   %valist = alloca i8
30   call void @llvm.va_start(ptr %valist)
31   call void @llvm.va_end(ptr %valist)
32   %x = call i32 @caller(ptr %b)
33   ret void
36 define i32 @caller2(ptr %x, ptr %y) {
37 ; CHECK-LABEL: define noundef i32 @caller2(ptr nocapture readonly %x, ptr %y)
38  entry:
39   call void(ptr,...) @va_func2(ptr %x, i32 0, i32 0, i32 0, ptr %y)
40   ret i32 42