In relocationViaAlloca()
for each given pair (Alloca, Def) for each Phi use of the Def for each its incoming value the incoming value is substituted with a new Load Alloca instruction generated at the end of the incoming block.
Phi is allowed to have several incoming (value, block) pairs with the same block only if their values are the same. So, we must not generate a new Load for an incoming block if we have already generated one Load for this block.
This patch keeps a Block->Load map to reuse generated Loads for their incoming block.