[ConstantFolding] Add support for saturating add/sub
authorSanjay Patel <spatel@rotateright.com>
Tue, 20 Nov 2018 17:05:55 +0000 (17:05 +0000)
committerSanjay Patel <spatel@rotateright.com>
Tue, 20 Nov 2018 17:05:55 +0000 (17:05 +0000)
commitefc3d1dfaae18a3da135504098174002d42cc76f
tree24f2ae943bd3ad513cd3500468d987348a546df9
parent537a5bfb7f1e9b85d615df95d7facacb5fb1638b
[ConstantFolding] Add support for saturating add/sub

Support saturating add/sub in constant folding, based on the APInt methods introduced in D54332.

Patch by: @nikic (Nikita Popov)

Differential Revision: https://reviews.llvm.org/D54531

llvm-svn: 347328
llvm/lib/Analysis/ConstantFolding.cpp
llvm/test/Analysis/ConstantFolding/saturating-add-sub.ll [new file with mode: 0644]