[PATCH] D93092: [PowerPC] KnownBits should be constant when performing non-sign comparison
Kai Luo via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 29 04:08:51 PST 2020
lkail added inline comments.
================
Comment at: llvm/lib/Target/PowerPC/PPCISelLowering.cpp:13192
- if (Op1Known.Zero != Op2Known.Zero || Op1Known.One != Op2Known.One)
+ if (!Op1Known.isConstant() || !Op2Known.isConstant() ||
+ Op1Known.getConstant() != Op2Known.getConstant())
----------------
nemanjai wrote:
> Hmm, but we've cleared bit zero from both known zero and known ones for both. So they will both be non-constant, won't they? I think that we would have to rewrite the above lines to something like this:
> ```
> // We don't really care about what is known about the first bit (if
> // anything), so pretend that it is known zero for both to ensure
> // they can be compared as constants.
> Op1Known.Zero.setBit(0); Op1Known.One.clearBit(0);
> Op2Known.Zero.setBit(0); Op2Known.One.clearBit(0);
> ```
Good catch! This check is over kill, since we are requiring Op1[1..BitWidth) == Op2[1..BitWidth). I tend to extract bits in [1..BitWidth) from `Op1` and `Op2` and do same constant check as above.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93092/new/
https://reviews.llvm.org/D93092
More information about the llvm-commits
mailing list