I found a bug in src/lib/backend/register_allocation.cpp where it raises a segmentation fault error when relocating excessive usage of registers into stack memory. Attached is the LLVM IR program that occurs the bug. I've checked that when ran with constexpr unsigned int MAX_REGISTER = 64U;, the backend produces the 33th register (which parser fails to understand).
After some debugging, it seems as the error origins from the function void insertLoadStore() in register_allocation.cpp. in particular the code uint64_t acc = dyn_cast<llvm::ConstantInt>(SP->getArgOperand(0))->getZExtValue(); in the line 485.
Here llvm::CallInst *SP holds a pointer to %1, so SP->getArgOperand(0) is actually a llvm::CallInst hence dyn_cast<llvm::ConstandInt>(SP->getArgOperand(0)) returns null.
To fix this bug, I have modified the mentioned line into the following code (both in void insertLoadStore() and void insertVectorLoadStore())
I found a bug in
src/lib/backend/register_allocation.cpp
where it raises a segmentation fault error when relocating excessive usage of registers into stack memory. Attached is the LLVM IR program that occurs the bug. I've checked that when ran withconstexpr unsigned int MAX_REGISTER = 64U;
, the backend produces the 33th register (which parser fails to understand).test_opt.txt
After some debugging, it seems as the error origins from the function
void insertLoadStore()
inregister_allocation.cpp
. in particular the codeuint64_t acc = dyn_cast<llvm::ConstantInt>(SP->getArgOperand(0))->getZExtValue();
in the line 485.Here
llvm::CallInst *SP
holds a pointer to%1
, soSP->getArgOperand(0)
is actually allvm::CallInst
hencedyn_cast<llvm::ConstandInt>(SP->getArgOperand(0))
returnsnull
.To fix this bug, I have modified the mentioned line into the following code (both in
void insertLoadStore()
andvoid insertVectorLoadStore()
)This fixed the bug for the moment, but I'm unsure if this is the right way to handle it. I would appreciate if you could review this issue!