llvm-project/llvm/lib
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
..
Analysis [SROA][TBAA] Handle shift of regular TBAA nodes 2021-04-14 14:35:20 -04:00
AsmParser [DebugInfo] Upgrade DISubragne::count to accept DIExpression also 2021-03-30 09:16:55 +05:30
BinaryFormat [NFC] Reordering parameters in getFile and getFileOrSTDIN 2021-03-25 09:47:49 -04:00
Bitcode Reapply "OpaquePtr: Turn inalloca into a type attribute" 2021-03-29 08:55:30 -04:00
Bitstream [llvm] Use llvm::append_range (NFC) 2021-01-06 18:27:33 -08:00
CodeGen SDAG: constant fold bf16 -> i16 casts 2021-04-14 11:27:46 +01:00
DWARFLinker [dsymutil] Stop emulating dsymutil-classic CIE caching behavior 2021-04-06 20:15:41 -07:00
DebugInfo [CodeView] Fix the ARM64 CPUType enum 2021-04-13 12:54:22 +03:00
Demangle [Demangle] Support demangling Swift calling convention in MS demangler. 2021-01-27 13:24:54 -08:00
ExecutionEngine [JITLink] Switch from StringRef to ArrayRef<char>, add some generic x86-64 utils 2021-03-30 21:07:24 -07:00
Extensions
FileCheck [FileCheck] Fix PR49531: invalid use of string var 2021-03-24 18:49:58 +00:00
Frontend [OpenMP] Change OMPIRBuilder to append function attributes 2021-03-24 09:08:29 -04:00
FuzzMutate [NFC] Reordering parameters in getFile and getFileOrSTDIN 2021-03-25 09:47:49 -04:00
Fuzzer
IR 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
IRReader [NFC] Reordering parameters in getFile and getFileOrSTDIN 2021-03-25 09:47:49 -04:00
InterfaceStub [elfabi] Fix a bug when .dynsym contains no non-local symbol 2021-02-19 11:36:53 -08:00
LTO [SystemZ][z/OS][Windows] Add new OF_TextWithCRLF flag and use this flag instead of OF_Text 2021-04-06 07:23:31 -04:00
LineEditor
Linker Reapply "OpaquePtr: Turn inalloca into a type attribute" 2021-03-29 08:55:30 -04:00
MC [AsmParser][SystemZ][z/OS] Add support to AsmLexer to accept HLASM style integers 2021-04-13 15:29:37 -04:00
MCA [MCA] Support carry-over instructions for in-order processors 2021-03-26 00:06:19 +03:00
Object [TextAPI] move source code files out of subdirectory, NFC 2021-04-05 10:24:42 -07:00
ObjectYAML [lld] Fixed CodeView GuidAdapter::format to handle GUID bytes in the right order. 2021-04-09 05:29:14 +04:00
Option [clang][cli] NFC: Remove ArgList infrastructure for recording queries 2021-02-25 13:53:24 +01:00
Passes [Passes] Add relative lookup table converter pass 2021-04-13 01:29:41 +00:00
ProfileData [CSSPGO] Fix dangling context strings and improve profile order consistency and error handling 2021-04-10 12:39:10 -07:00
Remarks Add intrinsics_gen as a dependency of libRemarks 2021-03-08 14:17:27 -08:00
Support [X86] Support -march=rocketlake 2021-04-13 09:48:13 +08:00
TableGen [TableGen] Resolve concrete but not complete field access initializers 2021-04-13 15:14:56 -07:00
Target [WebAssembly] Codegen for f64x2.convert_low_i32x4_{s,u} 2021-04-14 10:42:45 -07:00
Testing [clangd] Implement semanticTokens modifiers 2021-02-09 16:31:22 +01:00
TextAPI [TextAPI] move source code files out of subdirectory, NFC 2021-04-05 10:24:42 -07:00
ToolDrivers [NFC] Reordering parameters in getFile and getFileOrSTDIN 2021-03-25 09:47:49 -04:00
Transforms [InstCombine] Conditionally emit nowrap flags when combining two adds 2021-04-14 20:53:06 +02:00
WindowsManifest
XRay
CMakeLists.txt