mirror of
https://github.com/RPCS3/llvm.git
synced 2025-01-13 07:50:50 +00:00
[vectorizer] Fix a trivial oversight where we always requested the
number of vector registers rather than toggling between vector and scalar register number based on VF. I don't have a test case as I spotted this by inspection and on X86 it only makes a difference if your target is lacking SSE and thus has *no* vector registers. If someone wants to add a test case for this for ARM or somewhere else where this is more significant, that would be awesome. Also made the variable name a bit more sensible while I'm here. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200211 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
4bfa6fecc1
commit
3fa842d791
@ -4962,9 +4962,9 @@ LoopVectorizationCostModel::selectUnrollFactor(bool OptForSize,
|
||||
if (TC > 1 && TC < TinyTripCountUnrollThreshold)
|
||||
return 1;
|
||||
|
||||
unsigned TargetVectorRegisters = TTI.getNumberOfRegisters(true);
|
||||
DEBUG(dbgs() << "LV: The target has " << TargetVectorRegisters <<
|
||||
" vector registers\n");
|
||||
unsigned TargetNumRegisters = TTI.getNumberOfRegisters(VF > 1);
|
||||
DEBUG(dbgs() << "LV: The target has " << TargetNumRegisters <<
|
||||
" registers\n");
|
||||
|
||||
LoopVectorizationCostModel::RegisterUsage R = calculateRegisterUsage();
|
||||
// We divide by these constants so assume that we have at least one
|
||||
@ -4978,7 +4978,7 @@ LoopVectorizationCostModel::selectUnrollFactor(bool OptForSize,
|
||||
// Next, divide the remaining registers by the number of registers that is
|
||||
// required by the loop, in order to estimate how many parallel instances
|
||||
// fit without causing spills.
|
||||
unsigned UF = (TargetVectorRegisters - R.LoopInvariantRegs) / R.MaxLocalUsers;
|
||||
unsigned UF = (TargetNumRegisters - R.LoopInvariantRegs) / R.MaxLocalUsers;
|
||||
|
||||
// Clamp the unroll factor ranges to reasonable factors.
|
||||
unsigned MaxUnrollSize = TTI.getMaximumUnrollFactor();
|
||||
|
Loading…
x
Reference in New Issue
Block a user