This is an archive of the discontinued LLVM Phabricator instance.

[InstCombine] Canonicalize (-X srem Y) to -(X srem Y)
ClosedPublic

Authored by shchenz on Apr 13 2019, 12:58 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

shchenz created this revision.Apr 13 2019, 12:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2019, 12:58 AM
Herald added a subscriber: hiraditya. · View Herald Transcript
lebedev.ri accepted this revision.Apr 13 2019, 1:48 AM

LGTM, thank you

llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
1354 ↗(On Diff #195003)
----------------------------------------
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!
This revision is now accepted and ready to land.Apr 13 2019, 1:48 AM
This revision was automatically updated to reflect the committed changes.