blob: 1cb7ab137c02195ac6b7d84ffe3fedc5d05b0ddc [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
Meador Inge6b6a1612013-03-21 00:55:59 +00004
5declare i8* @fopen(i8*, i8*)
Nick Lewyckyc2ec0722013-07-06 00:29:58 +00006; CHECK: declare noalias i8* @fopen(i8* nocapture readonly, i8* nocapture readonly) [[G0:#[0-9]]]
Meador Inge6b6a1612013-03-21 00:55:59 +00007
8declare i8 @strlen(i8*)
9; CHECK: declare i8 @strlen(i8* nocapture) [[G1:#[0-9]]]
10
11declare i32* @realloc(i32*, i32)
12; CHECK: declare noalias i32* @realloc(i32* nocapture, i32) [[G0]]
13
14; Test deliberately wrong declaration
15
16declare i32 @strcpy(...)
17; CHECK: declare i32 @strcpy(...)
18
Philip Reames24667192016-01-04 22:49:23 +000019; operator new routines
20declare i8* @_Znwj(i64)
21; CHECK: declare noalias nonnull i8* @_Znwj(i64)
22declare i8* @_Znwm(i64)
23; CHECK: declare noalias nonnull i8* @_Znwm(i64)
24
Philip Reamesae050a52016-01-06 04:53:16 +000025declare void @memset_pattern16(i8*, i8*, i64)
26; CHECK: declare void @memset_pattern16(i8*, i8*, i64)
27; CHECK-POSIX: declare void @memset_pattern16(i8*, i8* readonly, i64) [[G2:#[0-9]+]]
28
Michael Gottesman2db11162013-07-03 04:00:54 +000029declare i32 @gettimeofday(i8*, i8*)
Michael Gottesmanbed2e822013-07-03 04:15:22 +000030; CHECK-POSIX: declare i32 @gettimeofday(i8* nocapture, i8* nocapture) [[G0:#[0-9]+]]
Michael Gottesman2db11162013-07-03 04:00:54 +000031
Meador Inge6b6a1612013-03-21 00:55:59 +000032; CHECK: attributes [[G0]] = { nounwind }
33; CHECK: attributes [[G1]] = { nounwind readonly }
Michael Gottesmanbed2e822013-07-03 04:15:22 +000034; CHECK-POSIX: attributes [[G0]] = { nounwind }
Philip Reamesae050a52016-01-06 04:53:16 +000035; CHECK-POSIX: attributes [[G2]] = { argmemonly }