@@ -33,7 +33,7 @@ using namespace llvm;
3333using namespace IGC ;
3434
3535AllocationLivenessAnalyzer::LivenessData
36- AllocationLivenessAnalyzer::ProcessInstruction (Instruction *I, DominatorTree &DT, LoopInfo &LI, bool includeOrigin ) {
36+ AllocationLivenessAnalyzer::ProcessInstruction (Instruction *I, DominatorTree &DT, LoopInfo &LI) {
3737 // static allocas are usually going to be in the entry block
3838 // that's a practice, but we only care about the last block that dominates all uses
3939 BasicBlock *commonDominator = nullptr ;
@@ -93,9 +93,14 @@ AllocationLivenessAnalyzer::ProcessInstruction(Instruction *I, DominatorTree &DT
9393 }
9494 }
9595 } 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 ;
99104 case Instruction::Load:
100105 if (II->getType ()->isPointerTy ())
101106 addUsesFn (II->uses ());
@@ -106,9 +111,6 @@ AllocationLivenessAnalyzer::ProcessInstruction(Instruction *I, DominatorTree &DT
106111 }
107112 }
108113
109- if (includeOrigin)
110- allUsers.insert (I);
111-
112114 return LivenessData (I, std::move (allUsers), LI, DT, commonDominator, std::move (lifetimeLeakingUsers));
113115}
114116
@@ -118,20 +120,6 @@ void AllocationLivenessAnalyzer::getAnalysisUsage(llvm::AnalysisUsage &AU) const
118120 getAdditionalAnalysisUsage (AU);
119121}
120122
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-
135123template <typename range>
136124static inline void doWorkLoop (SmallVector<BasicBlock *> &worklist, DenseSet<BasicBlock *> &bbSet1,
137125 DenseSet<BasicBlock *> &bbSet2, std::function<range(BasicBlock *)> iterate,
0 commit comments