diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2018-11-28 16:37:15 +0000 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2018-11-28 16:37:15 +0000 |
commit | 8d63aed45941eb40ee30cf80584d6fd024d56b53 (patch) | |
tree | 424b191c74900bc20d2beaf6c56db556641adc0c /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 42f89989a1ccfa7df637a2ffb9c6aa0e249c70e6 (diff) | |
download | llvm-8d63aed45941eb40ee30cf80584d6fd024d56b53.zip llvm-8d63aed45941eb40ee30cf80584d6fd024d56b53.tar.gz llvm-8d63aed45941eb40ee30cf80584d6fd024d56b53.tar.bz2 |
[InstCombine] Combine saturating add/sub with constant operands
Combine
sat(sat(X + C1) + C2) -> sat(X + (C1+C2))
and
sat(sat(X - C1) - C2) -> sat(X - (C1+C2))
if the sign of C1 and C2 matches.
In the unsigned case we can compute C1+C2 with saturating arithmetic,
and InstSimplify will reduce this just to the saturation value. For
the signed case, we cannot perform the simplification if the result
of the addition overflows.
This change is part of https://reviews.llvm.org/D54534.
llvm-svn: 347773
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions