From aff3ef6f6ccad9bd4e082546f8161727c2019117 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Wed, 27 Jan 2016 21:08:51 +0000 Subject: Vendor import of llvm release_38 branch r258968: https://llvm.org/svn/llvm-project/llvm/branches/release_38@258968 --- lib/Analysis/ScalarEvolution.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/Analysis/ScalarEvolution.cpp') diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 34074efd1ceb..ef1bb3a36c8d 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -5368,6 +5368,14 @@ ScalarEvolution::computeExitLimitFromCond(const Loop *L, BECount = EL0.Exact; } + // There are cases (e.g. PR26207) where computeExitLimitFromCond is able + // to be more aggressive when computing BECount than when computing + // MaxBECount. In these cases it is possible for EL0.Exact and EL1.Exact + // to match, but for EL0.Max and EL1.Max to not. + if (isa(MaxBECount) && + !isa(BECount)) + MaxBECount = BECount; + return ExitLimit(BECount, MaxBECount); } if (BO->getOpcode() == Instruction::Or) { -- cgit v1.3