mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[SLP]Improve and simplify extendSchedulingRegion.
We do not need to scan further if the upper end or lower end of the basic block is reached already and the instruction is not found. It means that the instruction is definitely in the lower part of basic block or in the upper block relatively. This should improve compile time for the very big basic blocks. Differential Revision: https://reviews.llvm.org/D99266
This commit is contained in:
parent
29c99e8499
commit
9c42655c14
@ -5338,41 +5338,39 @@ bool BoUpSLP::BlockScheduling::extendSchedulingRegion(Value *V,
|
||||
BasicBlock::reverse_iterator UpperEnd = BB->rend();
|
||||
BasicBlock::iterator DownIter = ScheduleEnd->getIterator();
|
||||
BasicBlock::iterator LowerEnd = BB->end();
|
||||
while (true) {
|
||||
while (UpIter != UpperEnd && DownIter != LowerEnd && &*UpIter != I &&
|
||||
&*DownIter != I) {
|
||||
if (++ScheduleRegionSize > ScheduleRegionSizeLimit) {
|
||||
LLVM_DEBUG(dbgs() << "SLP: exceeded schedule region size limit\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (UpIter != UpperEnd) {
|
||||
if (&*UpIter == I) {
|
||||
initScheduleData(I, ScheduleStart, nullptr, FirstLoadStoreInRegion);
|
||||
ScheduleStart = I;
|
||||
if (isOneOf(S, I) != I)
|
||||
CheckSheduleForI(I);
|
||||
LLVM_DEBUG(dbgs() << "SLP: extend schedule region start to " << *I
|
||||
<< "\n");
|
||||
return true;
|
||||
}
|
||||
++UpIter;
|
||||
}
|
||||
if (DownIter != LowerEnd) {
|
||||
if (&*DownIter == I) {
|
||||
initScheduleData(ScheduleEnd, I->getNextNode(), LastLoadStoreInRegion,
|
||||
nullptr);
|
||||
ScheduleEnd = I->getNextNode();
|
||||
if (isOneOf(S, I) != I)
|
||||
CheckSheduleForI(I);
|
||||
assert(ScheduleEnd && "tried to vectorize a terminator?");
|
||||
LLVM_DEBUG(dbgs() << "SLP: extend schedule region end to " << *I
|
||||
<< "\n");
|
||||
return true;
|
||||
}
|
||||
++DownIter;
|
||||
}
|
||||
assert((UpIter != UpperEnd || DownIter != LowerEnd) &&
|
||||
"instruction not found in block");
|
||||
++UpIter;
|
||||
++DownIter;
|
||||
}
|
||||
if (DownIter == LowerEnd || (UpIter != UpperEnd && &*UpIter == I)) {
|
||||
assert(I->getParent() == ScheduleStart->getParent() &&
|
||||
"Instruction is in wrong basic block.");
|
||||
initScheduleData(I, ScheduleStart, nullptr, FirstLoadStoreInRegion);
|
||||
ScheduleStart = I;
|
||||
if (isOneOf(S, I) != I)
|
||||
CheckSheduleForI(I);
|
||||
LLVM_DEBUG(dbgs() << "SLP: extend schedule region start to " << *I
|
||||
<< "\n");
|
||||
return true;
|
||||
}
|
||||
assert((UpIter == UpperEnd || (DownIter != LowerEnd && &*DownIter == I)) &&
|
||||
"Expected to reach top of the basic block or instruction down the "
|
||||
"lower end.");
|
||||
assert(I->getParent() == ScheduleEnd->getParent() &&
|
||||
"Instruction is in wrong basic block.");
|
||||
initScheduleData(ScheduleEnd, I->getNextNode(), LastLoadStoreInRegion,
|
||||
nullptr);
|
||||
ScheduleEnd = I->getNextNode();
|
||||
if (isOneOf(S, I) != I)
|
||||
CheckSheduleForI(I);
|
||||
assert(ScheduleEnd && "tried to vectorize a terminator?");
|
||||
LLVM_DEBUG(dbgs() << "SLP: extend schedule region end to " << *I << "\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -44,13 +44,9 @@ define void @exceed(double %0, double %1) {
|
||||
; CHECK: bb1:
|
||||
; CHECK-NEXT: br label [[LABEL:%.*]]
|
||||
; CHECK: bb2:
|
||||
; CHECK-NEXT: [[TMP17:%.*]] = extractelement <2 x double> [[TMP16]], i32 0
|
||||
; CHECK-NEXT: [[TMP18:%.*]] = insertelement <2 x double> poison, double [[TMP17]], i32 0
|
||||
; CHECK-NEXT: [[TMP19:%.*]] = extractelement <2 x double> [[TMP16]], i32 1
|
||||
; CHECK-NEXT: [[TMP20:%.*]] = insertelement <2 x double> [[TMP18]], double [[TMP19]], i32 1
|
||||
; CHECK-NEXT: br label [[LABEL]]
|
||||
; CHECK: label:
|
||||
; CHECK-NEXT: [[TMP21:%.*]] = phi <2 x double> [ [[TMP12]], [[BB1]] ], [ [[TMP20]], [[BB2]] ]
|
||||
; CHECK-NEXT: [[TMP17:%.*]] = phi <2 x double> [ [[TMP12]], [[BB1]] ], [ [[TMP16]], [[BB2]] ]
|
||||
; CHECK-NEXT: ret void
|
||||
;
|
||||
entry:
|
||||
|
Loading…
Reference in New Issue
Block a user