[PATCH] D156811: [InstCombine] Fold `select` of `srem` and conditional add

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 3 09:35:45 PDT 2023


craig.topper added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp:2616
+        IC.isKnownToBeAPowerOfTwo(Remainder, /*OrZero*/ true) &&
+        FalseVal == RemRes))
+    return nullptr;
----------------
goldstein.w.n wrote:
> This needs to be `TrueIfSigned ? (FalseVal == Rem) : (TrueVal == Rem)`
Wouldn't we need this right after we find the compare?

```
if (!TrueIfSigned)
  std::swap(TrueVal, FalseVal)
```


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

https://reviews.llvm.org/D156811



More information about the llvm-commits mailing list