https://llvm.org/bugs/show_bug.cgi?id=26638
Bug ID: 26638 Summary: RLEV does not optimize loop Product: libraries Version: trunk Hardware: PC OS: All Status: NEW Severity: normal Priority: P Component: Loop Optimizer Assignee: unassignedb...@nondot.org Reporter: san...@playingwithpointers.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified I'd expect -indvars to RLEV away `%count.0.lcssa` in the loop below: target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128" target triple = "x86_64-apple-macosx10.11.0" define i32 @count_odds(i32 %lim) { entry: %cmp8 = icmp sgt i32 %lim, 0 br i1 %cmp8, label %for.body, label %for.cond.cleanup for.cond.cleanup: ; preds = %for.body, %entry %count.0.lcssa = phi i32 [ 0, %entry ], [ %count.0.inc, %for.body ] ret i32 %count.0.lcssa for.body: ; preds = %entry, %for.body %i.010 = phi i32 [ %inc2, %for.body ], [ 0, %entry ] %count.09 = phi i32 [ %count.0.inc, %for.body ], [ 0, %entry ] %and = and i32 %i.010, 1 %count.0.inc = add i32 %and, %count.09 %inc2 = add i32 %i.010, 1 %exitcond = icmp eq i32 %inc2, %lim br i1 %exitcond, label %for.cond.cleanup, label %for.body } In C, this roughly corresponds to int count_odds(int lim) { int count = 0; for (int i = 0; i < lim; i++) if ((i & 1) == 1) count++; return count; } (except that I've removed the nsw and nuws) -- You are receiving this mail because: You are on the CC list for the bug.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs