diff options
| author | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-10-02 23:09:44 +0000 |
|---|---|---|
| committer | Sanjoy Das <sanjoy@playingwithpointers.com> | 2015-10-02 23:09:44 +0000 |
| commit | 55015d210f2b999f6f35083c4b337038bb99da47 (patch) | |
| tree | ec06c6e946ea662e572d53306ab7d6e2d21d968b /llvm/include | |
| parent | bd0998a1beccf1d88443f87b6c2ed738675ec564 (diff) | |
| download | bcm5719-llvm-55015d210f2b999f6f35083c4b337038bb99da47.tar.gz bcm5719-llvm-55015d210f2b999f6f35083c4b337038bb99da47.zip | |
[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
llvm-svn: 249211
Diffstat (limited to 'llvm/include')
| -rw-r--r-- | llvm/include/llvm/Analysis/ScalarEvolution.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h index 36e2477528c..c22423b2712 100644 --- a/llvm/include/llvm/Analysis/ScalarEvolution.h +++ b/llvm/include/llvm/Analysis/ScalarEvolution.h @@ -415,12 +415,18 @@ namespace llvm { /// Provide the special handling we need to analyze PHI SCEVs. const SCEV *createNodeForPHI(PHINode *PN); + /// Helper function called from createNodeForPHI. + const SCEV *createAddRecFromPHI(PHINode *PN); + + /// Helper function called from createNodeForPHI. + const SCEV *createNodeFromSelectLikePHI(PHINode *PN); + /// Provide special handling for a select-like instruction (currently this /// is either a select instruction or a phi node). \p I is the instruction /// being processed, and it is assumed equivalent to "Cond ? TrueVal : /// FalseVal". - const SCEV *createNodeForSelect(Instruction *I, Value *Cond, Value *TrueVal, - Value *FalseVal); + const SCEV *createNodeForSelectOrPHI(Instruction *I, Value *Cond, + Value *TrueVal, Value *FalseVal); /// Provide the special handling we need to analyze GEP SCEVs. const SCEV *createNodeForGEP(GEPOperator *GEP); |

