This is an archive of the discontinued LLVM Phabricator instance.

[LoopUnroll] Ignore ephemeral values when checking full unroll profitability.
ClosedPublic

Authored by a.elovikov on Mar 1 2018, 1:57 AM.

Details

Summary

Before this patch call graph is like this in the LoopUnrollPass:

tryToUnrollLoop
  ApproximateLoopSize
    collectEphemeralValues
    /* Use collected ephemeral values */
  computeUnrollCount
    analyzeLoopUnrollCost
      /* Bail out from the analysis if loop contains CallInst */

This patch moves collection of the ephemeral values to the tryToUnrollLoop
function and passes the collected values into both ApproximateLoopsize (as
before) and additionally starts using them in analyzeLoopUnrollCost:

tryToUnrollLoop
  collectEphemeralValues
  ApproximateLoopSize(EphValues)
    /* Use EphValues */
  computeUnrollCount(EphValues)
    analyzeLoopUnrollCost(EphValues)
      /* Ignore ephemeral values - they don't contribute to the final cost */
      /* Bail out from the analysis if loop contains CallInst */

Diff Detail

Repository
rL LLVM

Event Timeline

a.elovikov created this revision.Mar 1 2018, 1:57 AM
a.elovikov edited the summary of this revision. (Show Details)Mar 1 2018, 1:59 AM
This revision is now accepted and ready to land.Mar 14 2018, 12:04 PM
This revision was automatically updated to reflect the committed changes.