blob: 8ac45df6e7e11e4e07fb06e78dab13e7afc94fc2 [file] [log] [blame]
Chandler Carruth3a040e62015-12-27 08:41:34 +00001; RUN: opt < %s -inferattrs -S | FileCheck %s
2; RUN: opt < %s -passes=inferattrs -S | FileCheck %s
3; RUN: opt < %s -mtriple=x86_64-apple-macosx10.8.0 -inferattrs -S | FileCheck -check-prefix=CHECK-POSIX %s
David Majnemerae272d72016-03-31 21:29:57 +00004; RUN: opt < %s -mtriple=nvptx -inferattrs -S | FileCheck -check-prefix=CHECK-NVPTX %s
Meador Inge6b6a1612013-03-21 00:55:59 +00005
6declare i8* @fopen(i8*, i8*)
Nick Lewyckyc2ec0722013-07-06 00:29:58 +00007; CHECK: declare noalias i8* @fopen(i8* nocapture readonly, i8* nocapture readonly) [[G0:#[0-9]]]
Meador Inge6b6a1612013-03-21 00:55:59 +00008
9declare i8 @strlen(i8*)
10; CHECK: declare i8 @strlen(i8* nocapture) [[G1:#[0-9]]]
11
12declare i32* @realloc(i32*, i32)
13; CHECK: declare noalias i32* @realloc(i32* nocapture, i32) [[G0]]
14
15; Test deliberately wrong declaration
16
17declare i32 @strcpy(...)
18; CHECK: declare i32 @strcpy(...)
19
Philip Reames24667192016-01-04 22:49:23 +000020; operator new routines
21declare i8* @_Znwj(i64)
22; CHECK: declare noalias nonnull i8* @_Znwj(i64)
23declare i8* @_Znwm(i64)
24; CHECK: declare noalias nonnull i8* @_Znwm(i64)
25
Philip Reamesae050a52016-01-06 04:53:16 +000026declare void @memset_pattern16(i8*, i8*, i64)
27; CHECK: declare void @memset_pattern16(i8*, i8*, i64)
28; CHECK-POSIX: declare void @memset_pattern16(i8*, i8* readonly, i64) [[G2:#[0-9]+]]
29
Michael Gottesman2db11162013-07-03 04:00:54 +000030declare i32 @gettimeofday(i8*, i8*)
Michael Gottesmanbed2e822013-07-03 04:15:22 +000031; CHECK-POSIX: declare i32 @gettimeofday(i8* nocapture, i8* nocapture) [[G0:#[0-9]+]]
Michael Gottesman2db11162013-07-03 04:00:54 +000032
Meador Inge6b6a1612013-03-21 00:55:59 +000033; CHECK: attributes [[G0]] = { nounwind }
34; CHECK: attributes [[G1]] = { nounwind readonly }
Michael Gottesmanbed2e822013-07-03 04:15:22 +000035; CHECK-POSIX: attributes [[G0]] = { nounwind }
Philip Reamesae050a52016-01-06 04:53:16 +000036; CHECK-POSIX: attributes [[G2]] = { argmemonly }
David Majnemerae272d72016-03-31 21:29:57 +000037
38declare i32 @__nvvm_reflect(i8*)
39; CHECK-NVPTX: declare i32 @__nvvm_reflect(i8*) [[G0:#[0-9]+]]
40; CHECK-NVPTX: attributes [[G0]] = { nounwind readnone }