llvm-project/llvm/lib/Transforms/InstCombine
Nicolai Haehnle 870bf1788c [InstCombine] try to fold (select C, (sext A), B) into logical ops
Summary:
Turn (select C, (sext A), B) into (sext (select C, A, B')) when A is i1 and
B is a compatible constant, also for zext instead of sext. This will then be
further folded into logical operations.

The transformation would be valid for non-i1 types as well, but other parts of
InstCombine prefer to have sext from non-i1 as an operand of select.

Motivated by the shader compiler frontend in Mesa for AMDGPU, which emits i32
for boolean operations. With this change, the boolean logic is fully
recovered.

Reviewers: majnemer, spatel, tstellarAMD

Subscribers: llvm-commits

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

llvm-svn: 277801
2016-08-05 08:22:29 +00:00
..
CMakeLists.txt Use ADDITIONAL_HEADER_DIRS in all LLVM CMake projects. 2015-02-11 03:28:02 +00:00
InstCombineAddSub.cpp InstCombine: Replace some never-null pointers with references. NFC 2016-08-05 01:06:44 +00:00
InstCombineAndOrXor.cpp InstCombine: Clean up some trailing whitespace. NFC 2016-08-05 01:09:48 +00:00
InstCombineCalls.cpp InstCombine: Replace some never-null pointers with references. NFC 2016-08-05 01:06:44 +00:00
InstCombineCasts.cpp InstCombine: Clean up some trailing whitespace. NFC 2016-08-05 01:09:48 +00:00
InstCombineCompares.cpp InstCombine: Clean up some trailing whitespace. NFC 2016-08-05 01:09:48 +00:00
InstCombineInternal.h InstCombine: Replace some never-null pointers with references. NFC 2016-08-05 01:06:44 +00:00
InstCombineLoadStoreAlloca.cpp InstCombine: Clean up some trailing whitespace. NFC 2016-08-05 01:09:48 +00:00
InstCombineMulDivRem.cpp InstCombine: Replace some never-null pointers with references. NFC 2016-08-05 01:06:44 +00:00
InstCombinePHI.cpp InstCombine: Replace some never-null pointers with references. NFC 2016-08-05 01:06:44 +00:00
InstCombineSelect.cpp [InstCombine] try to fold (select C, (sext A), B) into logical ops 2016-08-05 08:22:29 +00:00
InstCombineShifts.cpp InstCombine: Replace some never-null pointers with references. NFC 2016-08-05 01:06:44 +00:00
InstCombineSimplifyDemanded.cpp don't repeat function names in comments; NFC 2016-07-14 20:54:43 +00:00
InstCombineVectorOps.cpp InstCombine: Replace some never-null pointers with references. NFC 2016-08-05 01:06:44 +00:00
InstructionCombining.cpp [InstCombine] try to fold (select C, (sext A), B) into logical ops 2016-08-05 08:22:29 +00:00
LLVMBuild.txt Update libdeps since TLI was moved from Target to Analysis in r226078. 2015-01-15 05:21:00 +00:00