llvm-project/llvm/lib/Transforms/InstCombine
Sanjay Patel 3b0bafee63 [InstCombine] canonicalize min/max constant to select's false value
This is a first step towards canonicalization and improved folding/codegen
for integer min/max as discussed here:
http://lists.llvm.org/pipermail/llvm-dev/2016-November/106868.html

Here, we're just matching the simplest min/max patterns and adjusting the
icmp predicate while swapping the select operands.

I've included FIXME tests in test/Transforms/InstCombine/select_meta.ll
so it's easier to see how this might be extended (corresponds to the TODO
comment in the code). That's also why I'm using matchSelectPattern()
rather than a simpler check; once the backend is patched, we can just 
remove some of the restrictions to allow the obfuscated min/max patterns
in the FIXME tests to be matched.

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

llvm-svn: 287585
2016-11-21 22:04:14 +00:00
..
CMakeLists.txt [CMake] NFC. Updating CMake dependency specifications 2016-11-17 04:36:50 +00:00
InstCombineAddSub.cpp [InstCombine] use m_APInt to allow sub with constant folds for splat vectors 2016-10-14 16:31:54 +00:00
InstCombineAndOrXor.cpp [InstCombine] add helper function for folding {and,or,xor} (cast X), C ; NFCI 2016-09-12 00:16:23 +00:00
InstCombineCalls.cpp [InstCombine][AVX-512] Teach InstCombineCalls how to handle the intrinsics for variable shift with 16-bit elements. 2016-11-18 06:04:33 +00:00
InstCombineCasts.cpp [InstCombine] clean up commonCastTransforms; NFC 2016-10-26 14:52:35 +00:00
InstCombineCompares.cpp [InstCombine] Fold nuw left-shifts in `ugt`/`ule` comparisons. 2016-11-01 19:19:29 +00:00
InstCombineInternal.h [InstCombine] handle simple vector integer constants in IsFreeToInvert 2016-10-27 17:30:50 +00:00
InstCombineLoadStoreAlloca.cpp Analysis: Move llvm::getConstantRangeFromMetadata to IR library. 2016-10-21 19:59:26 +00:00
InstCombineMulDivRem.cpp fix formatting; NFC 2016-11-21 21:48:36 +00:00
InstCombinePHI.cpp Use the range variant of find/find_if instead of unpacking begin/end 2016-08-12 03:55:06 +00:00
InstCombineSelect.cpp [InstCombine] canonicalize min/max constant to select's false value 2016-11-21 22:04:14 +00:00
InstCombineShifts.cpp [InstCombine] Folding of shifts by the sum of positive values 2016-11-01 15:40:30 +00:00
InstCombineSimplifyDemanded.cpp [X86] Remove the scalar intrinsics for fadd/fsub/fdiv/fmul 2016-11-16 05:24:10 +00:00
InstCombineVectorOps.cpp [InstCombine] avoid infinite loop from shuffle-extract-insert sequence (PR30923) 2016-11-10 00:15:14 +00:00
InstructionCombining.cpp Fix spelling mistakes in Transforms comments. NFC. 2016-11-20 13:19:49 +00:00
LLVMBuild.txt Update libdeps since TLI was moved from Target to Analysis in r226078. 2015-01-15 05:21:00 +00:00