[PATCH] D60647: [InstCombine] Canonicalize (-X srem Y) to -(X srem Y)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 13 01:51:49 PDT 2019


lebedev.ri accepted this revision.
lebedev.ri added a comment.
This revision is now accepted and ready to land.

LGTM, thank you



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp:1354
 
+  // -X srem Y --> -(X srem Y)
+  Value *X, *Y;
----------------
```
----------------------------------------
Optimization: tests
Precondition: true
  %o0 = sub nsw i8 0, %x
  %r = srem i8 %o0, %y
=>
  %n0 = srem i8 %x, %y
  %r = sub nsw i8 0, %n0

Done: 1
Optimization is correct!

```


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

https://reviews.llvm.org/D60647





More information about the llvm-commits mailing list