[llvm-commits] [llvm] r56247 - in /llvm/trunk: lib/Analysis/ScalarEvolution.cpp test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll test/Analysis/ScalarEvolution/avoid-smax-1.ll
Dan Gohman
gohman at apple.com
Tue Sep 16 11:52:57 PDT 2008
Author: djg
Date: Tue Sep 16 13:52:57 2008
New Revision: 56247
URL: http://llvm.org/viewvc/llvm-project?rev=56247&view=rev
Log:
Finally re-apply r46959. This is made feasible by the combination
of r56230, r56232, and r56246.
Modified:
llvm/trunk/lib/Analysis/ScalarEvolution.cpp
llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll
llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll
Modified: llvm/trunk/lib/Analysis/ScalarEvolution.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ScalarEvolution.cpp?rev=56247&r1=56246&r2=56247&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ScalarEvolution.cpp (original)
+++ llvm/trunk/lib/Analysis/ScalarEvolution.cpp Tue Sep 16 13:52:57 2008
@@ -1981,8 +1981,8 @@
// At this point, we would like to compute how many iterations of the
// loop the predicate will return true for these inputs.
- if (isa<SCEVConstant>(LHS) && !isa<SCEVConstant>(RHS)) {
- // If there is a constant, force it into the RHS.
+ if (LHS->isLoopInvariant(L) && !RHS->isLoopInvariant(L)) {
+ // If there is a loop-invariant, force it into the RHS.
std::swap(LHS, RHS);
Cond = ICmpInst::getSwappedPredicate(Cond);
}
Modified: llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll?rev=56247&r1=56246&r2=56247&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/2008-02-11-ReversedCondition.ll Tue Sep 16 13:52:57 2008
@@ -1,5 +1,4 @@
; RUN: llvm-as < %s | opt -scalar-evolution -analyze | grep {Loop header: (0 smax %n) iterations!}
-; XFAIL: *
define void @foo(i32 %n) {
entry:
Modified: llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll?rev=56247&r1=56246&r2=56247&view=diff
==============================================================================
--- llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll (original)
+++ llvm/trunk/test/Analysis/ScalarEvolution/avoid-smax-1.ll Tue Sep 16 13:52:57 2008
@@ -1,11 +1,13 @@
; RUN: llvm-as < %s | opt -indvars | llvm-dis > %t
-; RUN: not grep select %t
+; RUN: grep select %t | count 2
; RUN: grep {icmp ne i32.\* %w } %t
; Indvars should be able to insert a canonical induction variable
; for the bb6 loop without using a maximum calculation (icmp, select)
; because it should be able to prove that the comparison is guarded
-; by an appropriate conditional branch.
+; by an appropriate conditional branch. Unfortunately, indvars is
+; not yet able to find the comparison for the other too loops in
+; this testcase.
target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"
target triple = "i386-apple-darwin9"
More information about the llvm-commits
mailing list