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 | 163848021be5f594a4904e26e23ee892e0797c4d (patch) | |
| tree | 9fe4ae4d3eec41fa4cd31f8e3e7f087bcda53c97 /llvm/lib/Transforms | |
| parent | be504e82bcd21519c769c0433bac3161ec0d90cd (diff) | |
| download | bcm5719-llvm-163848021be5f594a4904e26e23ee892e0797c4d.tar.gz bcm5719-llvm-163848021be5f594a4904e26e23ee892e0797c4d.zip | |
Look through phi nodes and select instructions when
calculating nocapture attributes.
llvm-svn: 61535
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/IPO/FunctionAttrs.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp index 1824a710c51..52be0c906e1 100644 --- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp +++ b/llvm/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(); |

