Open llvmbot opened 13 years ago
It does look something like that when optimized (when -disable-simplify-libcalls is not specified).
(The reason I specified -disable-simplify-libcalls is because it is required for the program to be accepted by lli -firce-interpreter=true command.)
Variant of the given test that actually compiles with trunk:
@str = internal constant [12 x i8] c"hello world\00"
define i32 @main() nounwind { a: br label %g
e: ; preds = %g br label %g
f: ; preds = %g ret i32 0
g: ; preds = %g, %e, %a %z = phi i8 [ blockaddress(@main, %g), %a ], [ blockaddress(@main, %f), %e ], [ blockaddress(@main, %e), %g ] %puts = tail call i32 @puts(i8 getelementptr inbounds ([12 x i8] @str, i32 0, i32 0)) indirectbr i8 %z, [label %g, label %e, label %f] }
declare i32 @puts(i8* nocapture) nounwind
Crashes as reported. Probably some bug in the block address handling.
Extended Description
This works: llvm-as < testing.ll | opt -std-compile-opts -disable-simplify-libcalls | llc > testing.s; gcc testing.s; ./a.exe
This also works: llvm-as < testing.ll | opt -std-compile-opts -disable-simplify-libcalls | lli -force-interpreter=true
This doesn't work (I get a stack dump and no "hello world" output): llvm-as < testing.ll | opt -std-compile-opts -disable-simplify-libcalls | lli
---- Program code below ----
@A = internal constant [13 x i8] c"hello world\0A\00"
declare i32 @printf(i8* noalias nocapture,...)
define i32 @main() {
br label %a
a: br label %g
b: br label %c
c: br label %g
d: br label %e
e: br label %g
f: ret i32 0
g: %z = phi i8 [blockaddress(@main,%b),%a],[blockaddress(@main,%d),%c],[blockaddress(@main,%f),%e] %x = getelementptr [13 x i8] @A, i64 0, i64 0 call i32 (i8 noalias nocapture,...) @printf(i8 %x) indirectbr i8 %z, [label %b,label %d,label %f]
}