[SCEV] Recognize simple br-phi patterns
authorSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 2 Oct 2015 23:09:44 +0000 (23:09 +0000)
committerSanjoy Das <sanjoy@playingwithpointers.com>
Fri, 2 Oct 2015 23:09:44 +0000 (23:09 +0000)
commit23b6f4b2001f2e5bb40e997c05eff575650d0a09
tree9b3c6839e6f7bff12b830c6783b7409186cda846
parentcdc351d1c9f601f20dc3944bac28377bb9556da4
[SCEV] Recognize simple br-phi patterns

Summary:
Teach SCEV to match patterns like

```
  br %cond, label %left, label %right
 left:
  br label %merge
 right:
  br label %merge
 merge:
  V = phi [ %x, %left ], [ %y, %right ]
```

as "select %cond, %x, %y".  Before this SCEV would match PHI nodes
exclusively to add recurrences.

This addresses PR25005.

Reviewers: joker.eph, joker-eph, atrick

Subscribers: llvm-commits

Differential Revision: http://reviews.llvm.org/D13378

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249211 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Analysis/ScalarEvolution.h
lib/Analysis/ScalarEvolution.cpp
test/Analysis/ScalarEvolution/smax-br-phi-idioms.ll [new file with mode: 0644]