[PATCH] D13458: [SCEV] Pick backedge values for phi nodes correctly

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 6 01:45:35 PDT 2015


sanjoy created this revision.
sanjoy added reviewers: atrick, hfinkel.
sanjoy added a subscriber: llvm-commits.
sanjoy added a dependency: D13457: [SCEV] Use some C++11'ism, NFC.

`getConstantEvolutionLoopExitValue` and `ComputeExitCountExhaustively`
assumed all phi nodes in the loop header have the same order of incoming
values.  This is not correct, and this commit changes
`getConstantEvolutionLoopExitValue` and `ComputeExitCountExhaustively`
to lookup the backedge value of a phi node using the loop's latch block.

Unfortunately, there is still some code duplication
`getConstantEvolutionLoopExitValue` and `ComputeExitCountExhaustively`.
At some point in the future we should extract out a helper class /
method that can evolve constant evolution phi nodes across iterations.

Fixes 25060.  Thanks to Mattias Eriksson for the spot-on analysis!

Depends on D13457.

http://reviews.llvm.org/D13458

Files:
  lib/Analysis/ScalarEvolution.cpp
  test/Transforms/IndVarSimplify/pr25060.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D13458.36589.patch
Type: text/x-patch
Size: 4544 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20151006/a9ef6b27/attachment.bin>


More information about the llvm-commits mailing list