[PATCH] D134172: [InstCombine] Fold ult(add(x, -1), c) -> ule(x, c) iff x != 0 (PR57635)

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 19 08:16:45 PDT 2022


spatel added a comment.

Needs minimal tests for -instcombine alone.

I looked at this kind of pattern before, and it seems like a case of missing "nuw" analysis, but I didn't see a way to solve it given that we aggressively convert "sub" to "add" even if that means dropping "nuw". Once that information is lost, there's no way to recover without some kind of ValueTracking.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134172/new/

https://reviews.llvm.org/D134172



More information about the llvm-commits mailing list