[llvm-commits] [llvm] r61873 - /llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp
Duncan Sands
baldrick at free.fr
Wed Jan 7 11:17:02 PST 2009
Author: baldrick
Date: Wed Jan 7 13:17:02 2009
New Revision: 61873
URL: http://llvm.org/viewvc/llvm-project?rev=61873&view=rev
Log:
Reorder these.
Modified:
llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp
Modified: llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp?rev=61873&r1=61872&r2=61873&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/FunctionAttrs.cpp Wed Jan 7 13:17:02 2009
@@ -211,30 +211,6 @@
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 @@
// 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:
More information about the llvm-commits
mailing list