llvm-project/llvm/lib/Transforms/InstCombine
Sanjay Patel a003c728a5 [InstCombine] choose 1 form of abs and nabs as canonical
We already do this for min/max (see the blob above the diff), 
so we should do the same for abs/nabs.
A sign-bit check (<s 0) is used as a predicate for other IR 
transforms and it's likely the best for codegen.

This might solve the motivating cases for D47037 and D47041, 
but I think those patches still make sense. We can't guarantee 
this canonicalization if the icmp has more than one use.

Differential Revision: https://reviews.llvm.org/D47076

llvm-svn: 332819
2018-05-20 14:23:23 +00:00
..
CMakeLists.txt [CMake] NFC. Updating CMake dependency specifications 2016-11-17 04:36:50 +00:00
InstCombineAddSub.cpp [InstCombine] Moving overflow computation logic from InstCombine to ValueTracking; NFC 2018-05-10 19:46:19 +00:00
InstCombineAndOrXor.cpp [InstCombine] Propagate the nsw/nuw flags from the add in the 'shifty' abs pattern to the sub in the select version. 2018-05-17 16:29:52 +00:00
InstCombineCalls.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
InstCombineCasts.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
InstCombineCompares.cpp Fix a bunch of places where operator-> was used directly on the return from dyn_cast. 2018-05-05 01:57:00 +00:00
InstCombineInternal.h Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
InstCombineLoadStoreAlloca.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
InstCombineMulDivRem.cpp [InstCombine] Moving overflow computation logic from InstCombine to ValueTracking; NFC 2018-05-10 19:46:19 +00:00
InstCombinePHI.cpp Add a limit for phi folding instcombine 2018-05-17 19:24:03 +00:00
InstCombineSelect.cpp [InstCombine] choose 1 form of abs and nabs as canonical 2018-05-20 14:23:23 +00:00
InstCombineShifts.cpp Rename DEBUG macro to LLVM_DEBUG. 2018-05-14 12:53:11 +00:00
InstCombineSimplifyDemanded.cpp [X86] Remove and autoupgrade a bunch of FMA instrinsics that are no longer used by clang. 2018-05-11 21:59:34 +00:00
InstCombineVectorOps.cpp [InstCombine] Gracefully handle out of range extractelement indices 2017-12-27 12:00:18 +00:00
InstructionCombining.cpp [WebAssembly] Add Wasm personality and isScopedEHPersonality() 2018-05-17 20:52:03 +00:00
LLVMBuild.txt