[LLVMbugs] [Bug 4372] New: Calls to defined functions without a prototype aren' t transformed to direct calls

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Jun 11 11:54:24 PDT 2009


http://llvm.org/bugs/show_bug.cgi?id=4372

           Summary: Calls to defined functions without a prototype aren't
                    transformed to direct calls
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: LLVM Codegen
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: sharparrow1 at yahoo.com
                CC: llvmbugs at cs.uiuc.edu


Testcase:
__attribute((always_inline)) void foo() {}
int main(void) { foo(); return 0; }

Output of clang-cc -emit-llvm -O0:
define void @foo() nounwind alwaysinline {
entry:
        ret void
}

define i32 @main() nounwind {
entry:
        %retval = alloca i32            ; <i32*> [#uses=2]
        call void (...)* bitcast (void ()* @foo to void (...)*)()
        store i32 0, i32* %retval
        %0 = load i32* %retval          ; <i32> [#uses=1]
        ret i32 %0
}

EmitCall needs to be doing something similar to
ReplaceUsesOfNonProtoTypeWithRealFunction.

I think I introduced this issue recently with the fix to bug 4289, which
introduces the bitcast in question.


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list