diff options
author | Hal Finkel <hfinkel@anl.gov> | 2016-07-11 01:32:20 +0000 |
---|---|---|
committer | Hal Finkel <hfinkel@anl.gov> | 2016-07-11 01:32:20 +0000 |
commit | 5c12d8fe8f7ac9a3ec13ddad1561d63477e014f6 (patch) | |
tree | dd44cb608cfc199b1e9db70058b537669b386dcb /llvm/lib/Analysis/ValueTracking.cpp | |
parent | 47646c09818bd3571d72b3f0e312b1f301ec66ee (diff) | |
download | llvm-5c12d8fe8f7ac9a3ec13ddad1561d63477e014f6.zip llvm-5c12d8fe8f7ac9a3ec13ddad1561d63477e014f6.tar.gz llvm-5c12d8fe8f7ac9a3ec13ddad1561d63477e014f6.tar.bz2 |
BasicAA should look through functions with returned arguments
Motivated by the work on the llvm.noalias intrinsic, teach BasicAA to look
through returned-argument functions when answering queries. This is essential
so that we don't loose all other AA information when supplementing with
llvm.noalias.
Differential Revision: http://reviews.llvm.org/D9383
llvm-svn: 275035
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r-- | llvm/lib/Analysis/ValueTracking.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp index a059b76..5c5d213 100644 --- a/llvm/lib/Analysis/ValueTracking.cpp +++ b/llvm/lib/Analysis/ValueTracking.cpp @@ -2981,6 +2981,12 @@ Value *llvm::GetUnderlyingObject(Value *V, const DataLayout &DL, return V; V = GA->getAliasee(); } else { + if (auto CS = CallSite(V)) + if (Value *RV = CS.getReturnedArgOperand()) { + V = RV; + continue; + } + // See if InstructionSimplify knows any relevant tricks. if (Instruction *I = dyn_cast<Instruction>(V)) // TODO: Acquire a DominatorTree and AssumptionCache and use them. |