[InstSimplify] simplify add instruction if two operands are negative
ClosedPublic

Authored by shchenz on Jul 11 2018, 7:07 PM.

Details

Summary

This is from D48754, use isKnownNegation() function to simplify more add instruction patterns. such as:

define i8 @knownnegation(i8 %x, i8 %y) {
  %xy = sub i8 %x, %y
  %yx = sub i8 %y, %x
  %r = add i8 %xy, %yx
  ret i8 %r
}

--->

define i8 @knownnegation(i8 %x, i8 %y) {
  ret i8 0
}

Test cases are added at rL336822

Diff Detail

Repository
rL LLVM