[LLVMdev] Code generation problem
Russell Wallace
russell.wallace at gmail.com
Mon Feb 8 13:53:37 PST 2010
I was testing my implementation of the usual ternary function just
now, and it's giving the wrong answer; I would attribute this to an
error in my parser/abstract syntax tree code, but looking at the
output, as far as I can see, the intermediate code is correct at the
point where I hand it to LLVM's JIT. Could someone look and see if I'm
doing something wrong, misunderstanding the semantics of the
intermediate code format or something?
C:\aklo>ak
Aklo version 0 (32 bit)
> 1?2?3:4:5
declare void @abort()
define i32 @_main() {
br i32 1, label %1, label %6
; <label>:1 ; preds = %0
br i32 2, label %2, label %3
; <label>:2 ; preds = %1
br label %4
; <label>:3 ; preds = %1
br label %4
; <label>:4 ; preds = %3, %2
%5 = phi i32 [ 3, %2 ], [ 4, %3 ] ; <i32> [#uses=1]
br label %7
; <label>:6 ; preds = %0
br label %7
; <label>:7 ; preds = %6, %4
%8 = phi i32 [ %5, %4 ], [ 5, %6 ] ; <i32> [#uses=1]
ret i32 %8
}
4
(result is 4, should be 3)
More information about the llvm-dev
mailing list