(Adding llvm-dev back to the thread in case anyone else comes along
later with the same problem).
Your problem now is this prototype:
define i64 @"main"(i64 %".1")
That's almost certainly not how main is called on your system
(typically it has to be "i32 @main(i32, i8**)" or "i32 @main()" though
odder platforms will differ.
What value do you expect %.1 to have on entry? What do you expect to
happen to the value returned?
I suspect what you really want is to call your function "@fib" and
write a separate wrapper-function @main that calls @fib with sensible
arguments and maybe prints out the result afterwards. You could write
this in C and let Clang give you the IR you need. For example to take
the input as a command-line argument:
#include <stdio.h>
#include <stdlib.h>
long long fib(long long);
int main(int argc, char *argv) {
printf("%lld\n", fib(atoi(argv[1])));
}
Clang (when I run "clang -Os -S -o- -emit-llvm file.c") tells me the
IR for this is:
@.str = private unnamed_addr constant [6 x i8] c"%lld\0A\00", align 1
define i32 @main(i32, i8** nocapture readonly) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3, align 8
%5 = tail call i32 @atoi(i8* %4)
%6 = sext i32 %5 to i64
%7 = tail call i64 @fib(i64 %6)
%8 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6
x i8], [6 x i8]* @.str, i64 0, i64 0), i64 %7)
ret i32 0
}
declare i32 @printf(i8* nocapture readonly, ...)
declare i32 @atoi(i8* nocapture)
Put that into a module with your @fib definition and you should be
able to run lli on it:
$ lli combined_module.ll 12
233
$
Cheers.
Tim.