Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • opensrc/SMPStaticAnalyzer
1 result
Show changes
Commits on Source (1)
......@@ -8358,6 +8358,8 @@ bool SMPFunction::FindIVLiveRangeClosure(const size_t LoopIndex, const PhiSetIte
// For all instructions in the loop, find SSA nums for the PhiOp,
// whether USE or DEF. Accumulate closures, merge closures when
// they overlap, track whether operations are acceptable for an IV.
// Detect spills to memory and ignore ensuing USEs/DEFs until the item
// is unspilled from that memory location.
for (const size_t BlockNum : BlockNumList) {
SMPBasicBlock *CurrBlock = this->GetBlockByNum(BlockNum);
// Get Phi function DEF and USE SSA numbers.
......@@ -8413,12 +8415,41 @@ bool SMPFunction::FindIVLiveRangeClosure(const size_t LoopIndex, const PhiSetIte
if (!CurrBlock->IsVarKill(PhiOp))
continue; // save time
 
bool InSpillRange = false; // Waiting for unspill?
STARSOpndTypePtr SpillMemOp = nullptr;
for (vector<SMPInstr *>::const_iterator InstIter = CurrBlock->GetFirstConstInst();
InstIter != CurrBlock->GetLastConstInst(); ++InstIter) {
SMPInstr *CurrInst = (*InstIter);
STARSDefUseIter UseIter = CurrInst->FindUse(PhiOp);
if (UseIter != CurrInst->GetLastUse()) { // If so, search for spill.
STARSOpndTypePtr CurrSpillMemOp = CurrInst->GetMemDef();
STARSOpndTypePtr SourceOp = nullptr;
if ((nullptr != CurrSpillMemOp) && CurrInst->IsSimpleCopy(SourceOp)) { // store to memory
if (IsEqOpIgnoreBitwidth(SourceOp, PhiOp)) { // spill of PhiOp to memory
InSpillRange = true;
SpillMemOp = CurrSpillMemOp;
continue;
}
}
}
STARSDefUseIter DefIter = CurrInst->FindDef(PhiOp);
if (DefIter != CurrInst->GetLastDef()) {
int DefSSANum = DefIter->GetSSANum();
// Is this an unspill from memory?
STARSOpndTypePtr SourceOp = nullptr;
if (InSpillRange) {
if (CurrInst->IsSimpleCopy(SourceOp)) {
if (IsEqOp(SourceOp, SpillMemOp)) { // unspill from previous location
InSpillRange = false;
PhiIVTracker.CurrSSAClosure.SetBit((size_t)DefSSANum);
}
}
continue; // ignore if in spill range; if unspill, already handled by SetBit()
}
// See if PhiOp is also a USE, find its closure set.
STARSDefUseIter UseIter = CurrInst->FindUse(PhiOp);
int UseSSANum = DefSSANum; // lets us use FindSSAClosure() later
......@@ -975,8 +975,8 @@ void SMPProgram::Analyze(ProfilerInformation *pi, FILE *AnnotFile, FILE *InfoAnn
#endif // not SMP_REDUCED_ANALYSIS
SMP_msg("INFO: Maximum basic block count in one function: %lu\n", STARS_MaxBlockCount);
SMP_msg("INFO: Loop induction var ID failures: %lu successes: %lu\n", STARS_LoopInductionVarIDFailures, STARS_LoopInductionVarIDSuccesses);
SMP_msg("INFO: Loop iteration expr failures: %lu successes: %lu\n", STARS_LoopIterationExprFailures, STARS_LoopIterationExprSuccesses);
SMP_msg("INFO: Loop induction var ID failures: %lu : successes: %lu\n", STARS_LoopInductionVarIDFailures, STARS_LoopInductionVarIDSuccesses);
SMP_msg("INFO: Loop iteration expr failures: %lu : successes: %lu\n", STARS_LoopIterationExprFailures, STARS_LoopIterationExprSuccesses);
return;
} // end of SMPProgram::Analyze()
......