https://llvm.org/bugs/show_bug.cgi?id=24670
Bug ID: 24670 Summary: Induction variable simplification does not simplify truncates Product: libraries Version: trunk Hardware: PC OS: All Status: NEW Severity: normal Priority: P Component: Scalar Optimizations Assignee: unassignedb...@nondot.org Reporter: san...@playingwithpointers.com CC: llvm-bugs@lists.llvm.org Classification: Unclassified Currently LLVM does not optimize `%c0` to `i1 true` in the following example: declare void @use() define void @f(i32 %len) { entry: %e = icmp slt i32 0, %len br i1 %e, label %loop, label %leave loop: %idx = phi i64 [ 0, %entry ], [ %idx.inc, %be ] %idx.inc = add i64 %idx, 1 %idx.tr = trunc i64 %idx to i32 call void @use() %c0 = icmp slt i32 %idx.tr, %len br i1 %c0, label %be, label %leave be: %idx.inc.tr = trunc i64 %idx.inc to i32 call void @use() %c1 = icmp slt i32 %idx.inc.tr, %len br i1 %c1, label %loop, label %leave leave: ret void } The interesting bit is that SCEV already has all the smarts required to optimize this check away; and calling `simplifyLoopIVs` optimizes the check as expected. -indvars does not get this case because it does not look through truncates of induction variables, and thus does not try to eliminate `%c0`. -- 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