LLVM Virtual registers after RA pass?

I need to use ‘createVirtualRegister’ for a specific case in my ‘eliminateFrameIndex’ function implementation.

However, whenever that code is executed, I get the assertion "MachineCopyPropagation should be run after register allocation!” at a later stage.

I have seen that at least a couple of backend implementations (including ARM Thumb) create virtual registers in ‘eliminatedFrameIndex’.

What am I missing?, is there something that I need to set for virtual registers to be allowed after the RA pass, and specifically in the ‘eliminateFrameIndex’ function?


Joan Lluch
Puigsacalm, 7
17458 - Fornells de la Selva

Tel: 620 28 45 13

There are a number of hooks to control this in PrologEpilogInserter spread between TargetFrameLowering and TargetRegisterInfo. The one you most want to look at is probably TargetRegisterInfo::requiresFrameIndexScavenging.


Hi Matt,

Overriding both “requiresFrameIndexScavenging” and “requiresRegisterScavenging” to return true did the trick.

Thanks !!

Joan Lluch

Tel: 620 28 45 13