llvm-project/llvm/lib
Nikita Popov 8d63aed459 [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
2018-11-28 16:37:15 +00:00
..
Analysis [ValueTracking] Determine always-overflow condition for unsigned sub 2018-11-28 16:37:04 +00:00
AsmParser Attempt to fix buildbot after r347489 2018-11-23 11:28:58 +00:00
BinaryFormat Revert r347490 as it breaks address sanitizer builds 2018-11-23 17:13:06 +00:00
Bitcode [DebugInfo] DISubprogram flags get their own flags word. NFC. 2018-11-19 18:29:28 +00:00
CodeGen [MachineScheduler] Add support for clustering mem ops with FI base operands 2018-11-28 12:00:28 +00:00
DebugInfo Add missing error checking code intended for r347687 2018-11-27 19:14:11 +00:00
Demangle [Demangle] remove itaniumFindTypesInMangledName 2018-11-27 16:11:24 +00:00
ExecutionEngine [ExecutionEngine][Interpreter] Fix out-of-bounds array access. 2018-11-20 01:01:26 +00:00
FuzzMutate [New PM] Introducing PassInstrumentation framework 2018-09-20 17:08:45 +00:00
Fuzzer
IR [ThinLTO] Assembly representation of ReadOnly attribute 2018-11-23 10:54:51 +00:00
IRReader
LTO [ThinLTO] Consolidate cache key computation between new/old LTO APIs 2018-11-26 20:40:37 +00:00
LineEditor
Linker [ThinLTO] Internalize readonly globals 2018-11-16 07:08:00 +00:00
MC Revert r347490 as it breaks address sanitizer builds 2018-11-23 17:13:06 +00:00
Object Use llvm::copy. NFC 2018-11-17 01:44:25 +00:00
ObjectYAML [Hexagon] Add missing flags to ELF YAMLIO 2018-11-28 16:25:47 +00:00
OptRemarks Reland: [OptRemarks] Add library for parsing optimization remarks 2018-10-10 18:43:42 +00:00
Option [opt] Change the parameter of OptTable::PrintHelp from Name to Usage and don't append "[options] <inputs>" 2018-10-10 00:15:31 +00:00
Passes [stack-safety] Empty local passes for Stack Safety Global Analysis 2018-11-26 23:05:48 +00:00
ProfileData Support for remapping profile data when symbols change, for sample-based 2018-10-10 21:31:01 +00:00
Support Fix build error due to missing cctype include 2018-11-28 15:12:33 +00:00
TableGen [TableGen] Preprocessing support 2018-11-27 18:57:43 +00:00
Target [MachineScheduler] Add support for clustering mem ops with FI base operands 2018-11-28 12:00:28 +00:00
Testing Fix error with SmallString implicit conversion. 2018-09-06 22:47:32 +00:00
ToolDrivers [opt] Change the parameter of OptTable::PrintHelp from Name to Usage and don't append "[options] <inputs>" 2018-10-10 00:15:31 +00:00
Transforms [InstCombine] Combine saturating add/sub with constant operands 2018-11-28 16:37:15 +00:00
WindowsManifest
XRay [XRay] Improve FDR trace handling and error messaging 2018-11-09 06:26:48 +00:00
CMakeLists.txt Reland: [OptRemarks] Add library for parsing optimization remarks 2018-10-10 18:43:42 +00:00
LLVMBuild.txt Reland: [OptRemarks] Add library for parsing optimization remarks 2018-10-10 18:43:42 +00:00