summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2009-01-07 19:17:02 +0000
committerDuncan Sands <baldrick@free.fr>2009-01-07 19:17:02 +0000
commitacf984417fbb721467205011b5ef8f3595771df7 (patch)
tree4a02055861e4b2858a2985a706cb05bf10b07179
parent00e7ea98c0fd4a568fe974e79fb44913f173fa77 (diff)
downloadllvm-acf984417fbb721467205011b5ef8f3595771df7.tar.gz
llvm-acf984417fbb721467205011b5ef8f3595771df7.tar.bz2
llvm-acf984417fbb721467205011b5ef8f3595771df7.tar.xz
Reorder these.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61873 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/IPO/FunctionAttrs.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/lib/Transforms/IPO/FunctionAttrs.cpp b/lib/Transforms/IPO/FunctionAttrs.cpp
index 97f82ad851..877c7c9b50 100644
--- a/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -211,30 +211,6 @@ bool FunctionAttrs::isCaptured(Function &F, Value *V) {
unsigned Depth = UD.getInt();
switch (I->getOpcode()) {
- case Instruction::Store:
- if (V == I->getOperand(0)) {
- // Stored the pointer - it may be captured. If it is stored to a local
- // object (alloca) then track that object. Otherwise give up.
- Value *Target = I->getOperand(1)->getUnderlyingObject();
- if (!isa<AllocaInst>(Target))
- // Didn't store to an obviously local object - captured.
- return true;
- if (Depth >= 3)
- // Alloca recursion too deep - give up.
- return true;
- // Analyze all uses of the alloca.
- for (Value::use_iterator UI = Target->use_begin(),
- UE = Target->use_end(); UI != UE; ++UI) {
- UseWithDepth NUD(&UI.getUse(), Depth + 1);
- if (Visited.insert(NUD))
- Worklist.push_back(NUD);
- }
- }
- // Storing to the pointee does not cause the pointer to be captured.
- break;
- case Instruction::Free:
- // Freeing a pointer does not cause it to be captured.
- break;
case Instruction::Call:
case Instruction::Invoke: {
CallSite CS = CallSite::get(I);
@@ -259,6 +235,30 @@ bool FunctionAttrs::isCaptured(Function &F, Value *V) {
// captured.
break;
}
+ case Instruction::Free:
+ // Freeing a pointer does not cause it to be captured.
+ break;
+ case Instruction::Store:
+ if (V == I->getOperand(0)) {
+ // Stored the pointer - it may be captured. If it is stored to a local
+ // object (alloca) then track that object. Otherwise give up.
+ Value *Target = I->getOperand(1)->getUnderlyingObject();
+ if (!isa<AllocaInst>(Target))
+ // Didn't store to an obviously local object - captured.
+ return true;
+ if (Depth >= 3)
+ // Alloca recursion too deep - give up.
+ return true;
+ // Analyze all uses of the alloca.
+ for (Value::use_iterator UI = Target->use_begin(),
+ UE = Target->use_end(); UI != UE; ++UI) {
+ UseWithDepth NUD(&UI.getUse(), Depth + 1);
+ if (Visited.insert(NUD))
+ Worklist.push_back(NUD);
+ }
+ }
+ // Storing to the pointee does not cause the pointer to be captured.
+ break;
case Instruction::BitCast:
case Instruction::GetElementPtr:
case Instruction::Load: