llvm-6502/lib/Transforms/InstCombine
David Majnemer 12baade498 [InstCombine] Don't eagerly propagate nsw for A*B+A*C => A*(B+C)
InstCombine transforms A *nsw B +nsw A *nsw C to A *nsw (B + C).
This is incorrect -- e.g. if A = -1, B = 1, C = INT_SMAX. Then
nothing in the LHS overflows, but the multiplication in RHS overflows.

We need to first make sure that we won't multiple by INT_SMAX + 1.

Test case `add_of_mul` contributed by Sanjoy Das.

This fixes PR23635.

Differential Revision: http://reviews.llvm.org/D9629

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@238066 91177308-0d34-0410-b5e6-96231b3b80d8
2015-05-22 23:02:11 +00:00
..
CMakeLists.txt Use ADDITIONAL_HEADER_DIRS in all LLVM CMake projects. 2015-02-11 03:28:02 +00:00
InstCombineAddSub.cpp [ValueTracking] refactor: extract method haveNoCommonBitsSet 2015-05-14 23:53:19 +00:00
InstCombineAndOrXor.cpp [ConstantRange] Split makeICmpRegion in two. 2015-03-18 00:41:24 +00:00
InstCombineCalls.cpp [InstSimplify] Handle some overflow intrinsics in InstSimplify 2015-05-22 03:56:46 +00:00
InstCombineCasts.cpp Reapply r237539 with a fix for the Chromium build. 2015-05-20 18:41:25 +00:00
InstCombineCompares.cpp [InstSimplify] Handle some overflow intrinsics in InstSimplify 2015-05-22 03:56:46 +00:00
InstCombineInternal.h Rip min/max pattern matching out of InstCombine and into 2015-05-11 14:42:20 +00:00
InstCombineLoadStoreAlloca.cpp Convert PHI getIncomingValue() to foreach over incoming_values(). NFC. 2015-05-12 20:05:31 +00:00
InstCombineMulDivRem.cpp [InstCombine] (mul nsw 1, INT_MIN) != (shl nsw 1, 31) 2015-04-18 04:41:30 +00:00
InstCombinePHI.cpp Convert PHI getIncomingValue() to foreach over incoming_values(). NFC. 2015-05-12 20:05:31 +00:00
InstCombineSelect.cpp Reapply r237539 with a fix for the Chromium build. 2015-05-20 18:41:25 +00:00
InstCombineShifts.cpp Convert PHI getIncomingValue() to foreach over incoming_values(). NFC. 2015-05-12 20:05:31 +00:00
InstCombineSimplifyDemanded.cpp Reapply r237539 with a fix for the Chromium build. 2015-05-20 18:41:25 +00:00
InstCombineVectorOps.cpp [InstCombine] Use DataLayout to determine vector element width 2015-04-03 20:18:40 +00:00
InstructionCombining.cpp [InstCombine] Don't eagerly propagate nsw for A*B+A*C => A*(B+C) 2015-05-22 23:02:11 +00:00
LLVMBuild.txt Update libdeps since TLI was moved from Target to Analysis in r226078. 2015-01-15 05:21:00 +00:00
Makefile