How to debug Before Expand ISel Pseudo-instructions ?


I’m new to LLVM and I ran llc with -print-before-all and I can see that the IR is already wrong before Expand ISel Pseudo-instructions. The MOVE instruction moves a register to itself and shouldn’t be there. How do you debug something like this?

*** IR Dump After Module Verifier ***

define i32* @_Z9test_mathv() #0 {

%a = alloca i32, align 4

ret i32* %a


*** IR Dump Before Expand ISel Pseudo-instructions ***:

Machine code for function _Z9test_mathv: Properties: <>

Frame Objects:

fi#0: size=4, align=4, at location [SP]

BB#0: derived from LLVM BB %0

%vreg0 = MOVE %vreg0; CPURegs:%vreg0

%R4 = COPY %vreg0; CPURegs:%vreg0



"-debug" dumps a lot of additional information.  More specifically, "-debug-only=isel" probably has the information you're looking for.