Hi,
I created a function that lowers SLL to a few substitute instructions in multiple basic blocks, as mentioned in this question. I’m now trying to compile picolibc, but it fails on the file regexec.c. Looking deeper, it seems to be caused by a situation involving two consecutive SHL instructions in LLVM IR.
Looking at the error messages and the Machine IR itself, it looks like the branching behaviour is somehow getting messed up, such as incorrect blocks listed as successors, phi operands coming from non-predecessor blocks, and an empty basic block.
Isolated SHL instructions compile successfully, as well as situations with two SHL instructions separated by at least one other instruction. However, reordering statements in regexec.ll such that the two SHL instructions aren’t sequential (by moving %coldp134.i.i assignment one line up) didn’t compile.
Any guidance as to why this might be happening would be greatly appreciated.
I’ve attached the relevant portions of my lowering code, LLVM IR and llc output with --debug and -verify-machininstrs.
llc-debug-output-trimmed.txt (12.7 KB)
RISCVISelLowering-trimmed.cpp (3.2 KB)
regexec-ir-trimmed.txt (3.9 KB)