HomePhabricator

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

Description

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

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 */

Reviewers: mzolotukhin, evstupac, sanjoy

Reviewed By: evstupac

Subscribers: llvm-commits

Differential Revision: https://reviews.llvm.org/D43931

Details

Committed
a.elovikovMar 15 2018, 2:59 AM
Reviewer
evstupac
Differential Revision
D43931: [LoopUnroll] Ignore ephemeral values when checking full unroll profitability.
Parents
rL327616: [ELF] - Fix build bot after rL327612.
Branches
Unknown
Tags
Unknown