[PATCH] D117252: [InstCombine] Fold ashr-exact into a icmp-ugt.

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 14 11:01:32 PST 2022


lebedev.ri added inline comments.


================
Comment at: lib/Transforms/InstCombine/InstCombineCompares.cpp:2242
   if (IsAShr) {
-    if (Pred == CmpInst::ICMP_SLT || (Pred == CmpInst::ICMP_SGT && IsExact)) {
+    if (Pred == CmpInst::ICMP_SLT || Pred == CmpInst::ICMP_ULT || IsExact) {
       // icmp slt (ashr X, ShAmtC), C --> icmp slt X, (C << ShAmtC)
----------------
This should be
```
    if (IsExact || Pred == CmpInst::ICMP_SLT || Pred == CmpInst::ICMP_ULT) {

```


================
Comment at: test/Transforms/InstCombine/icmp-shr-lt-gt.ll:2219
 
+define i1 @lashr_00_00_noexact(i8 %x) {
+; CHECK-LABEL: @lashr_00_00_noexact(
----------------
Could you please ensure that there is a test for *every* comparison prediocate? (x2 because with/without `exact`)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117252



More information about the llvm-commits mailing list