Page MenuHomePhabricator

[RewriteStatepoints] Fix phis with different incoming Loads for the same incoming blocks
Needs RevisionPublic

Authored by yrouban on Mar 1 2018, 2:47 AM.

Details

Summary

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.

Diff Detail

Event Timeline

yrouban created this revision.Mar 1 2018, 2:47 AM
dneilson requested changes to this revision.Mar 1 2018, 6:54 AM

Please add a test case that demonstrates the patch in action (and would prevent regressions).

This revision now requires changes to proceed.Mar 1 2018, 6:54 AM