[PATCH] D156811: [InstCombine] Fold `select` of `srem` and conditional add

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 2 09:16:07 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:2616
+        Pred == ICmpInst::ICMP_SLT && CmpCond == Rem))
+    return nullptr;
+
----------------
antoniofrighetto wrote:
> goldstein.w.n wrote:
> > Can you move this check to before the other match. 1) think its clearer, 2) if you add the generic `isKnownToBeAPowerOfTwo` approach is good to exhaust all the cheap checks before the recursive call.
> Moved above, and moved from using `m_Power2` to the generic `isKnownToBeAPowerOfTwo`.
Please update you proofs to replace `8` with a variable `C` and use assume to provide its constraints (in your case pow2 or zero).


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

https://reviews.llvm.org/D156811



More information about the llvm-commits mailing list