summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-12-31 20:21:34 +0000
committerDuncan Sands <baldrick@free.fr>2008-12-31 20:21:34 +0000
commit1010941954a44520d12037d8b6d81a4af89b57a6 (patch)
tree9352382906fc7c9128f8bf896c36b16f79409434 /lib
parent587cbd00586eab20477f78935b7695a5009710f1 (diff)
downloadllvm-1010941954a44520d12037d8b6d81a4af89b57a6.tar.gz
llvm-1010941954a44520d12037d8b6d81a4af89b57a6.tar.bz2
llvm-1010941954a44520d12037d8b6d81a4af89b57a6.tar.xz
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')
-rw-r--r--lib/Transforms/IPO/FunctionAttrs.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/Transforms/IPO/FunctionAttrs.cpp b/lib/Transforms/IPO/FunctionAttrs.cpp
index 1824a710c5..52be0c906e 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();