[PATCH] D156811: [InstCombine] Fold `select` of `srem` and conditional add
Antonio Frighetto via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 3 02:02:31 PDT 2023
antoniofrighetto added a comment.
Updated & rebased!
================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:2616
+ FalseVal == RemRes &&
+ IC.isKnownToBeAPowerOfTwo(Remainder, /*OrZero*/ true)))
+ return nullptr;
----------------
goldstein.w.n wrote:
> craig.topper wrote:
> > This uses `isKnownToBeAPowerOfTwo`, but the tests only check for constants. `isKnownToBeAPowerOfTwo` handles more than that.
> > This uses `isKnownToBeAPowerOfTwo`, but the tests only check for constants. `isKnownToBeAPowerOfTwo` handles more than that.
>
> +1
Good point, updated tests with `rem_euclid_non_const_pow2`, thanks!
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D156811/new/
https://reviews.llvm.org/D156811
More information about the llvm-commits
mailing list