diff options
| author | Hal Finkel <hfinkel@anl.gov> | 2016-07-11 02:48:23 +0000 |
|---|---|---|
| committer | Hal Finkel <hfinkel@anl.gov> | 2016-07-11 02:48:23 +0000 |
| commit | e186debb8b08429bf075b14b645effaa7ca387a0 (patch) | |
| tree | 29c0e72172639a85cd081ef56e136f1bb27106ed /llvm/lib | |
| parent | 6fd5e1f02bf414803a86b6877a61818fb8914597 (diff) | |
| download | bcm5719-llvm-e186debb8b08429bf075b14b645effaa7ca387a0.tar.gz bcm5719-llvm-e186debb8b08429bf075b14b645effaa7ca387a0.zip | |
Teach SCEV to look through returned-argument functions
When building SCEVs, if a function is known to return its argument, then we can
build the SCEV using the corresponding argument value.
Differential Revision: http://reviews.llvm.org/D9381
llvm-svn: 275037
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 9c1712ab771..2abbf348035 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -5225,6 +5225,13 @@ const SCEV *ScalarEvolution::createSCEV(Value *V) { if (isa<Instruction>(U)) return createNodeForSelectOrPHI(cast<Instruction>(U), U->getOperand(0), U->getOperand(1), U->getOperand(2)); + break; + + case Instruction::Call: + case Instruction::Invoke: + if (Value *RV = CallSite(U).getReturnedArgOperand()) + return getSCEV(RV); + break; } return getUnknown(V); |

