preserving an implicit def between basic blocks

Hi,

I have the following problem:
In BB0 there is an instruction that defines a flag (implicit def) and in BB1 there is one that reads the flag (implicit use). When i run llc with -O3, the instruction in BB0 that defines the flag is removed. How can i prevent this? BB0 and BB1 are consecutive basic blocks.

Thanks,
Alex

The SSA form of machine instructions does not support physical registers live across basic blocks.

You can mark your flag register as reserved to prevent DeadMachineInstructionElim from removing the defining instructions.

/jakob