diff options
author | Duncan Sands <baldrick@free.fr> | 2008-12-31 20:21:34 +0000 |
---|---|---|
committer | Duncan Sands <baldrick@free.fr> | 2008-12-31 20:21:34 +0000 |
commit | 7120a89c7f4886b42b816bface60fd1accc206c6 (patch) | |
tree | 9352382906fc7c9128f8bf896c36b16f79409434 /lib/Transforms/IPO | |
parent | 797a489ac5f56f3718d445b9392d8b742f8ec157 (diff) | |
download | external_llvm-7120a89c7f4886b42b816bface60fd1accc206c6.zip external_llvm-7120a89c7f4886b42b816bface60fd1accc206c6.tar.gz external_llvm-7120a89c7f4886b42b816bface60fd1accc206c6.tar.bz2 |
Look through phi nodes and select instructions when
calculating nocapture attributes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61535 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/IPO')
-rw-r--r-- | lib/Transforms/IPO/FunctionAttrs.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Transforms/IPO/FunctionAttrs.cpp b/lib/Transforms/IPO/FunctionAttrs.cpp index 1824a71..52be0c9 100644 --- a/lib/Transforms/IPO/FunctionAttrs.cpp +++ b/lib/Transforms/IPO/FunctionAttrs.cpp @@ -225,9 +225,14 @@ bool FunctionAttrs::isCaptured(Function &F, Value *V) { continue; } - if (isa<BitCastInst>(I) || isa<GetElementPtrInst>(I)) { - // Type conversion or calculating an offset. Does not escape if the new - // value doesn't. + if (isa<BitCastInst>(I) || isa<GetElementPtrInst>(I) || + isa<PHINode>(I) || isa<SelectInst>(I)) { + // Type conversion, calculating an offset, or merging values. + // The original value does not escape via this if the new value doesn't. + // Note that in the case of a select instruction it is important that + // the value not be used as the condition, since otherwise one bit of + // information might escape. It cannot be the condition because it has + // the wrong type. for (Instruction::use_iterator UI = I->use_begin(), UE = I->use_end(); UI != UE; ++UI) { Use *U = &UI.getUse(); |