@@ -33,7 +33,7 @@ using namespace llvm;
33
33
using namespace IGC ;
34
34
35
35
AllocationLivenessAnalyzer::LivenessData
36
- AllocationLivenessAnalyzer::ProcessInstruction (Instruction *I, DominatorTree &DT, LoopInfo &LI, bool includeOrigin ) {
36
+ AllocationLivenessAnalyzer::ProcessInstruction (Instruction *I, DominatorTree &DT, LoopInfo &LI) {
37
37
// static allocas are usually going to be in the entry block
38
38
// that's a practice, but we only care about the last block that dominates all uses
39
39
BasicBlock *commonDominator = nullptr ;
@@ -93,9 +93,14 @@ AllocationLivenessAnalyzer::ProcessInstruction(Instruction *I, DominatorTree &DT
93
93
}
94
94
}
95
95
} break ;
96
- case Instruction::Call:
97
- implementCallSpecificBehavior (cast<CallInst>(II), use, worklist, allUsers, lifetimeLeakingUsers);
98
- break ;
96
+ case Instruction::Call: {
97
+ auto *callI = cast<CallInst>(II);
98
+ if (!callI->doesNotCapture (use->getOperandNo ()))
99
+ lifetimeLeakingUsers.insert (II);
100
+
101
+ if (II->getType ()->isPointerTy ())
102
+ addUsesFn (II->uses ());
103
+ } break ;
99
104
case Instruction::Load:
100
105
if (II->getType ()->isPointerTy ())
101
106
addUsesFn (II->uses ());
@@ -106,9 +111,6 @@ AllocationLivenessAnalyzer::ProcessInstruction(Instruction *I, DominatorTree &DT
106
111
}
107
112
}
108
113
109
- if (includeOrigin)
110
- allUsers.insert (I);
111
-
112
114
return LivenessData (I, std::move (allUsers), LI, DT, commonDominator, std::move (lifetimeLeakingUsers));
113
115
}
114
116
@@ -118,20 +120,6 @@ void AllocationLivenessAnalyzer::getAnalysisUsage(llvm::AnalysisUsage &AU) const
118
120
getAdditionalAnalysisUsage (AU);
119
121
}
120
122
121
- void AllocationLivenessAnalyzer::implementCallSpecificBehavior (CallInst *callI, Use* use, SmallVector<Use *> &worklist,
122
- SetVector<Instruction *> &allUsers,
123
- SetVector<Instruction *> &lifetimeLeakingUsers) {
124
-
125
- if (!callI->doesNotCapture (use->getOperandNo ()))
126
- lifetimeLeakingUsers.insert (callI);
127
-
128
- if (callI->getType ()->isPointerTy ()) {
129
-
130
- for (auto &use : callI->uses ())
131
- worklist.push_back (&use);
132
- }
133
- }
134
-
135
123
template <typename range>
136
124
static inline void doWorkLoop (SmallVector<BasicBlock *> &worklist, DenseSet<BasicBlock *> &bbSet1,
137
125
DenseSet<BasicBlock *> &bbSet2, std::function<range(BasicBlock *)> iterate,
0 commit comments