I've stumbled across a bug with the AOT compiler. Compiling the following code causes an "Instruction does not dominate all uses!" error from LLVM:

--*begin code*--

def test_method(a_hash)
  a_hash.each{|k,v| puts "Key: #{k} and Value: #{v}"}
end

test_method({:hello => 'world'})

--*end code*--

I haven't had time to add this to test_vm, but I did narrow down the issue to this region of the generated llvm assembly:

--*begin code*--

rescue_save_vars:               ; preds = %MainBlock
%7 = call i8* @llvm.eh.exception() ; <i8*> [#uses=2] %8 = call i64 (i8*, i8*, ...)* @llvm.eh.selector.i64(i8* %7, i8* bitcast (i8* ()* @__gxx_personality_v0 to i8*), i8* null) ; <i64> [#uses=0] %9 = call i8* @__cxa_begin_catch(i8* %7) ; <i8*> [#uses=0]
        %10 = load i8** %1              ; <i8*> [#uses=2]
        %11 = icmp eq i8* %10, null             ; <i1> [#uses=1]
        br i1 %11, label %merge, label %not_null

normal:         ; preds = %MainBlock
        %12 = load i64* @6              ; <i64> [#uses=2]
        %13 = load i8** %1              ; <i8*> [#uses=1]
call void (i8*, i32, ...)* @rb_vm_keep_vars(i8* %13, i32 1, i64 %12, i64* %0)
        ret i64 %6

not_null:               ; preds = %rescue_save_vars
call void (i8*, i32, ...)* @rb_vm_keep_vars(i8* %10, i32 1, i64 %12, i64* %0)
        br label %merge

--*end code*--

Specifically, the issue is that "not_null" can be accessed directly from "rescue_save_vars" leaving %12 undefined. I've attached the related files.

Cheers,

Josh


def test_method(a_hash)
  a_hash.each{|k,v| puts "Key: #{k} and Value: #{v}"}
end

test_method({:hello => 'world'})

Attachment: test.ll
Description: Binary data

_______________________________________________
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel

Reply via email to