1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00
llvm-mirror/lib/Transforms
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
..
Coroutines Use phi ranges to simplify code. No functionality change intended. 2017-12-30 15:27:33 +00:00
Hello
InstCombine [InstCombine] fold min/max tree with common operand (PR35717) 2018-01-08 15:05:34 +00:00
Instrumentation Avoid int to string conversion in Twine or raw_ostream contexts. 2017-12-28 16:58:54 +00:00
IPO WholeProgramDevirt: Simplify ORE getter mechanism for old PM. NFCI. 2018-01-05 00:27:51 +00:00
ObjCARC Remove redundant includes from lib/Transforms. 2017-12-13 21:31:01 +00:00
Scalar Revert "[SCCP] Manually fold branches on undef." 2018-01-07 22:09:44 +00:00
Utils [CodeExtractor] Use subset of function attributes for extracted function. 2018-01-07 11:22:25 +00:00
Vectorize [SLP] Fix PR35777: Incorrect handling of aggregate values. 2018-01-08 14:43:06 +00:00
CMakeLists.txt
LLVMBuild.txt