Discount invariant instructions in full unrolling
authorPhilip Reames <listmail@philipreames.com>
Fri, 14 May 2021 17:57:59 +0000 (10:57 -0700)
committerPhilip Reames <listmail@philipreames.com>
Fri, 14 May 2021 18:07:19 +0000 (11:07 -0700)
commit23c93c255549f440444b10d73d439bedc0d6822d
tree2254a4fa6990ab94aa71c6512f8f867bf38a48c0
parentdfacb8c8d432f20b2ccb832b34bfab52a45784bb
Discount invariant instructions in full unrolling

This patch updates the cost model for full unrolling to discount the cost of a loop invariant expression on all but one iteration. The reasoning here is that such an expression (as determined by SCEV) will be CSEd or DSEd once the loop is unrolled. Note that SCEVs reasoning will find things which could be invariant, not simply those outside the loop.

Differential Revision: https://reviews.llvm.org/D102506
llvm/lib/Analysis/LoopUnrollAnalyzer.cpp
llvm/test/Transforms/LoopUnroll/full-unroll-invariant.ll [new file with mode: 0644]