llvm-project/llvm/lib/Transforms
Mehrnoosh Heidarpour 29f189f90d [InstCombine] Conditionally emit nowrap flags when combining two adds
Currently, the InstCombineCompare is combining two add operations
into a single add operation which always has a nsw flag, without
checking the conditions to see if this flag should be present
according to the original two add operations or not.

This patch will change the InstCombineCompare to emit the nsw or
nuw only when these flags are allowed to be generated according to
the original add operations and remove the possibility of applying
wrong optimization with passes that will perform on the IR later
in the pipeline.

To confirm that the current results are buggy and the results after
proposed patch are the correct IR the following examples from Alive2
are attached; the same results can be seen in the case of nuw flag
and nsw is just used as an example. The following link shows that
the generated IR with current LLVM is a buggy IR when none of the
original add operations have nsw flag.
https://alive2.llvm.org/ce/z/WGaDrm
The following link proves that the generated IR after the patch in
the former case is the correct IR.
https://alive2.llvm.org/ce/z/wQ7G_e

Differential Revision: https://reviews.llvm.org/D100095
2021-04-14 20:53:06 +02:00
..
AggressiveInstCombine [Transforms] Use llvm::append_range (NFC) 2021-01-20 21:35:54 -08:00
CFGuard llvmbuildectomy - replace llvm-build by plain cmake 2020-11-13 10:35:24 +01:00
Coroutines Revert "Reapply "[DebugInfo] Use variadic debug values to salvage BinOps and GEP instrs with non-const operands"" 2021-04-12 20:10:17 -07:00
Hello
IPO Revert "[GlobalOpt] Revert valgrind hacks" 2021-04-13 17:47:07 -07:00
InstCombine [InstCombine] Conditionally emit nowrap flags when combining two adds 2021-04-14 20:53:06 +02:00
Instrumentation [SantizerCoverage] handle missing DBG MD when inserting libcalls 2021-04-12 15:55:58 -07:00
ObjCARC [NFC][AA] Prepare to convert AliasResult to class with PartialAlias offset. 2021-04-09 12:54:22 +03:00
Scalar [SCCP] Follow up of rGbbab9f986c6d. NFC. 2021-04-14 17:14:46 +01:00
Utils [SCCP] Follow up of rGbbab9f986c6d. NFC. 2021-04-14 17:14:46 +01:00
Vectorize [SLP] createOp - fix null dereference warning. NFCI. 2021-04-14 15:24:41 +01:00
CMakeLists.txt [NewPM][HelloWorld] Move HelloWorld to Utils 2021-02-03 12:59:40 -08:00