Open FelixKawala opened 1 month ago
What error messages are you seeing ? I'd like additional informations on your setup to make sure I can reproduce properly.
Looks like an issue with closure conversion
Indeed. It's the same thing as: https://github.com/AnyDSL/thorin/issues/116
I note that mem2reg could also be made a bit stronger, and this would hide the bug in this case by effectively removing the array. But the real bug is that our closure conversion pass is busted and needs a rewrite. I attempted one last year but ended up shelving it because it was based on an experimental branch that ended up being unworkable.
What error messages are you seeing ? I'd like additional informations on your setup to make sure I can reproduce properly.
Seems like you already reproduced it. Here are some infos anyways.
I run a 64 Bit Ubuntu 22.04.4 LTS
on an all-AMD machine.
The Error/Assertion I'm seeing is:
artic: /home/felix/repo/anydsl-metaproject/llvm-project/llvm/lib/IR/Instructions.cpp:631: void llvm::CallInst::init(llvm::FunctionType*, llvm::Value*, llvm::ArrayRef<llvm::Value*>, llvm::ArrayRef<llvm::OperandBundleDefT<llvm::Value*> >, const llvm::Twine&): Assertion `(Args.size() == FTy->getNumParams() || (FTy->isVarArg() && Args.size() > FTy->getNumParams())) && "Calling a function with bad signature!"' failed.
make[2]: *** [CMakeFiles/svgf.dir/build.make:105: min_abstraction_example.ll] Aborted (core dumped)
make[2]: *** Deleting file 'min_abstraction_example.ll'
make[1]: *** [CMakeFiles/Makefile2:217: CMakeFiles/svgf.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
Might have two separate issues here. I commented some peculiarities I found while playing around with the code.
Issue description:
Seems like adding an external function messes up the code generation, when arrays of functions are assigned. This also happens for arrays of structs that contain functions.
Issues:
It seems like only the last function that was written to (in an array of functions) can be accessed, when using an external function in the loop.
We also can't use range(...) to write to the function array. We need to use unroll(...).
The following code will not compile in the current configuration: