1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
llvm-mirror/lib/Transforms/InstCombine
Sanjay Patel 782c5d6f79 [InstCombine] fold min/max tree with common operand (PR35717)
There is precedence for factorization transforms in instcombine for FP ops with fast-math. 
We also have similar logic in foldSPFofSPF().

It would take more work to add this to reassociate because that's specialized for binops, 
and min/max are not binops (or even single instructions). Also, I don't have evidence that 
larger min/max trees than this exist in real code, but if we find that's true, we might
want to reorganize where/how we do this optimization.

In the motivating example from https://bugs.llvm.org/show_bug.cgi?id=35717 , we have:

int test(int xc, int xm, int xy) {
  int xk;
  if (xc < xm)
    xk = xc < xy ? xc : xy;
  else
    xk = xm < xy ? xm : xy;
  return xk;
}

This patch solves that problem because we recognize more min/max patterns after rL321672

https://rise4fun.com/Alive/Qjne
https://rise4fun.com/Alive/3yg

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

llvm-svn: 321998
2018-01-08 15:05:34 +00:00
..
CMakeLists.txt
InstCombineAddSub.cpp [InstCombine] canonicalize constant-minus-boolean to select-of-constants 2017-12-06 21:22:57 +00:00
InstCombineAndOrXor.cpp [InstCombine] canonicalize shifty abs(): ashr+add+xor --> cmp+neg+sel 2017-12-16 16:41:17 +00:00
InstCombineCalls.cpp [InstCombine] Check for isa<Instruction> before using cast<> 2017-12-28 09:35:35 +00:00
InstCombineCasts.cpp [InstCombine] include 'sub' in the list of narrow-able binops 2017-11-16 14:40:51 +00:00
InstCombineCompares.cpp [InstCombine] safely create a constant of the right type (PR35794) 2018-01-04 14:31:56 +00:00
InstCombineInternal.h Create instruction classes for identifying any atomicity of memory intrinsic. (NFC) 2017-10-30 19:51:48 +00:00
InstCombineLoadStoreAlloca.cpp Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00
InstCombineMulDivRem.cpp [InstCombine] Missed optimization in math expression: squashing sqrt functions 2018-01-02 05:58:11 +00:00
InstCombinePHI.cpp Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00
InstCombineSelect.cpp [InstCombine] fold min/max tree with common operand (PR35717) 2018-01-08 15:05:34 +00:00
InstCombineShifts.cpp [InstCombine] Check for out of range shift values using APInt before calling getZExtValue 2018-01-03 18:28:20 +00:00
InstCombineSimplifyDemanded.cpp [InstCombine] Fix SimplifyDemandedUseBits SHL handling (PR35515) 2017-12-09 23:42:56 +00:00
InstCombineVectorOps.cpp [InstCombine] Gracefully handle out of range extractelement indices 2017-12-27 12:00:18 +00:00
InstructionCombining.cpp [PM][InstCombine] fixing omission of AliasAnalysis in new-pass-manager's version of InstCombine 2017-12-14 10:36:31 +00:00
LLVMBuild.txt