What may I assume about MachineFunctions.

Upon writing my register allocation algorithm, I am concerned that a load may be skipped due to a branch.

For instance consider the psudocode

int x = 1

if( false )
load x
y = 3x
else
y = 4
x

The load happens in the false block because this is when the variable is first seen. The load is not preformed in the else block because the register allocator may see it loaded already.

Do I need to be concerned about cases like this?

Thanks,
Jeff Kunkel

For the record, the if-else series works as a series of BasicBlocks. See the http://llvm.org/docs/tutorial/LangImpl6.html page for a more detailed explanation. But, the simple answer is yes, the allocator does have to worry about load/stores across blocks.

Thanks,
Jeff Kunkel