I found this with LLVM 2.3 and reproduced with svn as of about thirty
minutes ago and they both fail in the same way.
If you run this code through opt -instcombine
define fastcc i64 @fibo(i64) {
switch i64 %0, label %2 [
i64 0, label %8
i64 1, label %8
]
; <label>:2 ; preds = %1
%3 = sub i64 %0, 1 ; <i64> [#uses=1]
%4 = call i64 @fibo(i64 %3) ; <i64> [#uses=1]
%5 = sub i64 %0, 2 ; <i64> [#uses=1]
%6 = call i64 @fibo(i64 %5) ; <i64> [#uses=1]
%7 = add i64 %4, %6 ; <i64> [#uses=1]
ret i64 %7
; <label>:8 ; preds = %1, %1
ret i64 1
}
you get this crap back
define fastcc i64 @fibo(i64) {
switch i64 %0, label %2 [
i64 0, label %4
i64 1, label %4
]
; <label>:2 ; preds = %1
store i1 true, i1* undef
store i1 true, i1* undef
%3 = add i64 undef, undef ; <i64> [#uses=1]
ret i64 %3
; <label>:4 ; preds = %1, %1
ret i64 1
}
(which, called in a program gives an instant bus error)
Arnaud
On Oct 5, 2008, at 10:55 PM, Arnaud Bergeron wrote:> I found this with LLVM 2.3 and reproduced with svn as of about thirty > minutes ago and they both fail in the same way. > > If you run this code through opt -instcombineYour input code has undefined behavior. You have to mark the callsite as fastcc also. -Chris
2008/10/6 Chris Lattner <clattner at apple.com>:> > On Oct 5, 2008, at 10:55 PM, Arnaud Bergeron wrote: > >> I found this with LLVM 2.3 and reproduced with svn as of about thirty >> minutes ago and they both fail in the same way. >> >> If you run this code through opt -instcombine > > Your input code has undefined behavior. You have to mark the callsite > as fastcc also.Thanks. I didn't know that. Arnaud> -Chris > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >