[PATCH] D67334: [InstCombine] fold sign-bit compares of srem
Sanjay Patel via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 9 07:09:51 PDT 2019
spatel added a comment.
In D67334#1662930 <https://reviews.llvm.org/D67334#1662930>, @RKSimon wrote:
> Slightly beyond the scope of this patch, but would it be realistic to support non-constant cases? I know at present m_Power2 can't handle this
Yes, this patch is only for constant divisors. We could use ValueTracking's isKnownToBeAPowerOfTwo() and be more general. But in that case, the transform would require 2 extra instructions: sub + or to produce the bitmask. It's unusual for instcombine to increase instruction sequences, but this is probably a justifiable case since there's almost no analysis for srem. Another option would be to add an SDAG expansion for that.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D67334/new/
https://reviews.llvm.org/D67334
More information about the llvm-commits
mailing list