[PATCH] D38177: [LoopPredication] Support ule, sle latch predicates

Max Kazantsev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 02:00:42 PDT 2017


mkazantsev added inline comments.


================
Comment at: test/Transforms/LoopPredication/basic.ll:158
+; CHECK: loop.preheader:
+; CHECK: [[first_iteration_check:[^ ]+]] = icmp ult i32 0, %length
+; CHECK-NEXT: [[limit_check:[^ ]+]] = icmp slt i32 %n, %length
----------------
Consider case `%n = 10, %length = -100`. The original code will successfully pass through the guard (because `0 <u -100` is true) and then executes normally. After the loop is predicated, the condition `icmp slt i32 %n, %length` becomes false, and we don't go to the loop and deoptimize. Is it a problem?


https://reviews.llvm.org/D38177





More information about the llvm-commits mailing list