[PATCH] D121355: [SelectionDAG] Fold shift constants into cmp
Allen zhong via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 28 09:43:46 PDT 2022
Allen marked an inline comment as done.
Allen added a comment.
ping? @craig.topper
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:4552
+ // Replace C1 with (NewC << ShiftBits) is legal
+ // X < C1 -> X < (NewC << ShiftBits)
+ // X >= C1 -> X >= (NewC << ShiftBits)
----------------
craig.topper wrote:
> The first two cases never happen do they?
>
> In those cases `C1 == NewC << ShiftBits` and we already checked isLegalICmpImmediate on line 4500.
Yes, thanks very much!
I think AndRHS->getAPIntValue().isPowerOf2() will be matched, so I update the comment.
================
Comment at: llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp:4552
+ // Replace C1 with (NewC << ShiftBits) is legal
+ // X < C1 -> X < (NewC << ShiftBits)
+ // X >= C1 -> X >= (NewC << ShiftBits)
----------------
Allen wrote:
> craig.topper wrote:
> > The first two cases never happen do they?
> >
> > In those cases `C1 == NewC << ShiftBits` and we already checked isLegalICmpImmediate on line 4500.
> Yes, thanks very much!
>
> I think AndRHS->getAPIntValue().isPowerOf2() will be matched, so I update the comment.
hi, @craig.topper:
I had update the comment, do you have other suggestion ?
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D121355/new/
https://reviews.llvm.org/D121355
More information about the llvm-commits
mailing list