-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
Bugzilla Link | 3520 |
Resolution | FIXED |
Resolved on | Feb 11, 2009 04:02 |
Version | trunk |
OS | Linux |
Reporter | LLVM Bugzilla Contributor |
CC | @nlewycky |
Extended Description
Builtin functions aren't picking up their nocapture attributes:
$ cat x.c
extern int use(char*x) {
return strlen(x);
}
$ llvm-gcc -O2 x.c -S -o - -emit-llvm
x.c: In function ‘use’:
x.c:2: warning: incompatible implicit declaration of built-in function ‘strlen’
; ModuleID = 'x.c'
target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128"
target triple = "x86_64-unknown-linux-gnu"
define i32 @use(i8* %x) nounwind readonly {
entry:
%0 = tail call i64 @strlen(i8* %x) nounwind readonly ; [#uses=1]
%1 = trunc i64 %0 to i32 ; [#uses=1]
ret i32 %1
}
declare i64 @strlen(i8*) nounwind readonly
because SimplifyLibCalls::doInitialization is never being called even though runOnFunction is. By contrast if you run opt -simplifylibcalls, it works fine.