avoid unnecessary extend arrays

This commit is contained in:
Ruobing Han 2022-09-23 09:15:10 -04:00
parent c6442c8b23
commit 63c9cc566c
1 changed files with 3 additions and 5 deletions

View File

@ -76,7 +76,7 @@ int need_nested_loop;
// adding multiple kenerl in file support // adding multiple kenerl in file support
bool ShouldNotBeContextSaved(llvm::Instruction *instr) { bool ShouldNotBeContextSaved(llvm::Instruction *instr, DivergenceInfo &DI) {
if (isa<BranchInst>(instr)) if (isa<BranchInst>(instr))
return true; return true;
@ -91,9 +91,7 @@ bool ShouldNotBeContextSaved(llvm::Instruction *instr) {
if (load_addr == M->getGlobalVariable("warp_vote")) if (load_addr == M->getGlobalVariable("warp_vote"))
return true; return true;
} }
// TODO: we should further analyze whether the local variable return !DI.isDivergent(*instr);
// is same among all threads within a wrap
return false;
} }
// generate countpart alloc in the beginning of the Function // generate countpart alloc in the beginning of the Function
@ -394,7 +392,7 @@ void handle_local_variable_intra_warp(std::vector<ParallelRegion> PRs,
for (llvm::BasicBlock::iterator instr = bb->begin(); instr != bb->end(); for (llvm::BasicBlock::iterator instr = bb->begin(); instr != bb->end();
++instr) { ++instr) {
llvm::Instruction *instruction = &*instr; llvm::Instruction *instruction = &*instr;
if (ShouldNotBeContextSaved(instruction)) if (ShouldNotBeContextSaved(instruction, DI))
continue; continue;
for (Instruction::use_iterator ui = instruction->use_begin(), for (Instruction::use_iterator ui = instruction->use_begin(),
ue = instruction->use_end(); ue = instruction->use_end();