[InstCombine][NFC] Tests for 'unsigned add overflow' check
authorRoman Lebedev <lebedev.ri@gmail.com>
Thu, 5 Sep 2019 17:40:28 +0000 (17:40 +0000)
committerRoman Lebedev <lebedev.ri@gmail.com>
Thu, 5 Sep 2019 17:40:28 +0000 (17:40 +0000)
commit745046c23f76d3f44f81f5fb5b504a62df380464
tree1e49fa40cd1c42547634185fd62d0496afcd310f
parent541ab7130e2c34097fd9e15f70ce193a37c2ad19
[InstCombine][NFC] Tests for 'unsigned add overflow' check

----------------------------------------
Name: unsigned add, overflow, v0
  %add = add i8 %x, %y
  %ov = icmp ult i8 %add, %x
=>
  %agg = uadd_overflow i8 %x, %y
  %add = extractvalue {i8, i1} %agg, 0
  %ov = extractvalue {i8, i1} %agg, 1

Done: 1
Optimization is correct!

----------------------------------------
Name: unsigned add, overflow, v1
  %add = add i8 %x, %y
  %ov = icmp ult i8 %add, %y
=>
  %agg = uadd_overflow i8 %x, %y
  %add = extractvalue {i8, i1} %agg, 0
  %ov = extractvalue {i8, i1} %agg, 1

Done: 1
Optimization is correct!

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

Done: 1
Optimization is correct!

----------------------------------------
Name: unsigned add, no overflow, v1
  %add = add i8 %x, %y
  %ov = icmp uge i8 %add, %y
=>
  %agg = uadd_overflow i8 %x, %y
  %add = extractvalue {i8, i1} %agg, 0
  %not.ov = extractvalue {i8, i1} %agg, 1
  %ov = xor %not.ov, -1

Done: 1
Optimization is correct!

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