[InstCombine][NFC] Tests for 'unsigned sub overflow' check
authorRoman Lebedev <lebedev.ri@gmail.com>
Thu, 5 Sep 2019 17:40:37 +0000 (17:40 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Thu, 5 Sep 2019 17:40:37 +0000 (17:40 +0000)
commit1d9e0dcc9d4e34288ba752371dd925a5b54218d4
tree64bda184b7d0323d9b2f0d254a9bc53477c6b5ce
parent745046c23f76d3f44f81f5fb5b504a62df380464
[InstCombine][NFC] Tests for 'unsigned sub overflow' check

----------------------------------------
Name: unsigned sub, overflow, v0
  %sub = sub i8 %x, %y
  %ov = icmp ugt i8 %sub, %x
=>
  %agg = usub_overflow i8 %x, %y
  %sub = extractvalue {i8, i1} %agg, 0
  %ov = extractvalue {i8, i1} %agg, 1

Done: 1
Optimization is correct!

----------------------------------------
Name: unsigned sub, no overflow, v0
  %sub = sub i8 %x, %y
  %ov = icmp ule i8 %sub, %x
=>
  %agg = usub_overflow i8 %x, %y
  %sub = extractvalue {i8, i1} %agg, 0
  %not.ov = extractvalue {i8, i1} %agg, 1
  %ov = xor %not.ov, -1

Done: 1
Optimization is correct!

llvm-svn: 371099
llvm/test/Transforms/InstCombine/unsigned-sub-lack-of-overflow-check.ll [new file with mode: 0644]
llvm/test/Transforms/InstCombine/unsigned-sub-overflow-check.ll [new file with mode: 0644]