jlm-print
crashes on programs compiled with certain optimizations enabled, such as -loop-unroll
. However, this happens only after it the bytecode is passed through jlm-opt
, even when this is run without performing any optimizations.
Tested on programs from the polybench benchmark suite: https://github.com/phate/polybench-jlm.
Steps to reproduce (requires both the jlm-opt
and opt
steps in this specific order to crash)
clang -S -emit-llvm -Xclang -disable-llvm-passes -o 2mm.ll linear-algebra/kernels/2mm/2mm.c -Iutilities
jlm-opt --llvm 2mm.ll > 2mm-jlm.ll
opt -S -loop-unroll -o 2mm-opt.ll 2mm-jlm.ll
jlm-print --j2rx --file 2mm-opt.ll
throws the follwing
terminate called after throwing an instance of 'jlm::error'
what(): expected at least two arguments.
with stack trace:
Program received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff40e6535 in __GI_abort () at abort.c:79
#2 0x00007ffff44ae983 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#3 0x00007ffff44b48c6 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#4 0x00007ffff44b4901 in std::terminate() () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#5 0x00007ffff44b4b34 in __cxa_throw () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x00005555555ec60c in jlm::phi_op::phi_op(std::vector<jlm::cfg_node*, std::allocator<jlm::cfg_node*> > const&, jive::type const&) ()
#7 0x000055555564b737 in jlm::create_phi_tac ()
#8 0x000055555564e7d8 in jlm::convert_phi_instruction(llvm::Instruction*, std::vector<std::unique_ptr<jlm::tac, std::default_delete<jlm
::tac> >, std::allocator<std::unique_ptr<jlm::tac, std::default_delete<jlm::tac> > > >&, jlm::context&) ()
#9 0x00005555556517ab in jlm::convert_instruction(llvm::Instruction*, std::vector<std::unique_ptr<jlm::tac, std::default_delete<jlm::ta
c> >, std::allocator<std::unique_ptr<jlm::tac, std::default_delete<jlm::tac> > > >&, jlm::context&) ()
#10 0x00005555555cd0e1 in jlm::convert_basic_blocks(llvm::SymbolTableList<llvm::BasicBlock>&, jlm::context&) ()
#11 0x00005555555cd8d2 in jlm::create_cfg(llvm::Function&, jlm::context&) ()
#12 0x00005555555cdb4b in jlm::convert_function(llvm::Function&, jlm::context&) ()
#13 0x00005555555ce379 in jlm::convert_globals(llvm::Module&, jlm::context&) ()
#14 0x00005555555ce46e in jlm::convert_module(llvm::Module&) ()
#15 0x0000555555567796 in main ()
The same error is encountered for every such fail.
The -lcssa
and -licm
optimizations fail for all benchmarks programs, and -indvars
, -loop-deletion
, -loop-idiom
, -loop-rotate
, -loop-sink
, -loop-unroll
, and -loop-unswitch
fail for the following benchmarks:
2mm, 3mm, adi, cholesky, correlation, covariance, deriche, doitgen, fdtd-2d, floyd-warshall, gemm, gemver, gramschmidt, heat-3d, jacobi-2d, ludcmp, lu, mvt, nussinov, seidel-2d, symm, syr2k, syrk, and trmm.
bug