llvm-project/llvm/lib/Transforms/InstCombine
Sanjay Patel 681a6a3990 [InstCombine] allow more folds more multi-use selects
The 'and' case showed up in a recent bug report and prevented
more follow-on transforms from happening.

We could handle more patterns (for example, the select arms
simplified, but not to constant values), but this seems
like a safe, conservative enhancement. The backend can
convert select-of-constants to math/logic in many cases
if it is profitable.

There is a lot of overlapping logic for these kinds of patterns
(see SimplifySelectsFeedingBinaryOp() and FoldOpIntoSelect()),
so there may be some opportunity to improve efficiency.

There are also optimization gaps/inconsistency because we do
not call this code for all bin-opcodes (see TODO for ashr test).
2022-11-11 15:26:54 -05:00
..
CMakeLists.txt
InstCombineAddSub.cpp [InstCombine] fold `sub + and` pattern with specific const value 2022-11-05 12:58:45 +08:00
InstCombineAndOrXor.cpp [InstCombine] refactor the SimplifyUsingDistributiveLaws NFC 2022-10-30 21:04:06 +08:00
InstCombineAtomicRMW.cpp [LLVM] Add the support for fmax and fmin in atomicrmw instruction 2022-07-06 10:57:53 -04:00
InstCombineCalls.cpp [AliasAnalysis] Introduce getModRefInfoMask() as a generalization of pointsToConstantMemory(). 2022-10-31 13:03:41 -07:00
InstCombineCasts.cpp [InstCombine] reduce multi-use casts+masks 2022-11-06 09:07:17 -05:00
InstCombineCompares.cpp InstCombine: Fold compare with smallest normal if input denormals are flushed 2022-11-07 07:16:47 -08:00
InstCombineInternal.h InstCombine: Fold fdiv nnan x, 0 -> copysign(inf, x) 2022-11-07 22:00:15 -08:00
InstCombineLoadStoreAlloca.cpp [AliasAnalysis] Introduce getModRefInfoMask() as a generalization of pointsToConstantMemory(). 2022-10-31 13:03:41 -07:00
InstCombineMulDivRem.cpp InstCombine: Fold fdiv nnan x, 0 -> copysign(inf, x) 2022-11-07 22:00:15 -08:00
InstCombineNegator.cpp [InstCombine] don't canonicalize shl+sub to mul+add 2022-09-21 08:39:07 -04:00
InstCombinePHI.cpp [InstCombine] Directly replace instr in foldIntegerTypedPHI() (NFCI) 2022-10-05 13:28:23 +02:00
InstCombineSelect.cpp [InstCombine] use logical-and matcher to avoid crash 2022-11-02 08:23:52 -04:00
InstCombineShifts.cpp [InstCombine] propagate 'exact' when converting ashr to lshr 2022-10-07 13:17:19 -04:00
InstCombineSimplifyDemanded.cpp [InstCombine] Allow simplify demanded transformations on scalable vectors 2022-10-31 13:39:36 -07:00
InstCombineVectorOps.cpp [InstCombine] Remove redundant splats in InstCombineVectorOps 2022-11-07 15:39:05 +00:00
InstructionCombining.cpp [InstCombine] allow more folds more multi-use selects 2022-11-11 15:26:54 -05:00