Skip to content

llvm-gcc never calls SimplifyLibCalls::doInitialization #3892

@llvmbot

Description

@llvmbot
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillallvm-toolsAll llvm tools that do not have corresponding tag

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions