[llvm] r288278 - Fix LSR best register search algorithm.
Evgeny Stupachenko via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 30 14:23:51 PST 2016
Author: evstupac
Date: Wed Nov 30 16:23:51 2016
New Revision: 288278
URL: http://llvm.org/viewvc/llvm-project?rev=288278&view=rev
Log:
Fix LSR best register search algorithm.
Summary:
Fix a case when first register in a search has maximum
RegUses.getUsedByIndices(Reg).count()
Reviewers: qcolombet
Differential Revision: http://reviews.llvm.org/D26877
From: Evgeny Stupachenko <evstupac at gmail.com>
Modified:
llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp?rev=288278&r1=288277&r2=288278&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/LoopStrengthReduce.cpp Wed Nov 30 16:23:51 2016
@@ -4178,9 +4178,10 @@ void LSRInstance::NarrowSearchSpaceByPic
for (const SCEV *Reg : RegUses) {
if (Taken.count(Reg))
continue;
- if (!Best)
+ if (!Best) {
Best = Reg;
- else {
+ BestNum = RegUses.getUsedByIndices(Reg).count();
+ } else {
unsigned Count = RegUses.getUsedByIndices(Reg).count();
if (Count > BestNum) {
Best = Reg;
More information about the llvm-commits
mailing list