tree-optimization/95393 - fold MIN/MAX_EXPR generated by phiopt
authorRichard Biener <rguenther@suse.de>
Fri, 29 May 2020 07:25:53 +0000 (09:25 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 29 May 2020 08:15:57 +0000 (10:15 +0200)
commit07852a81f58532c63a57631d7c3757fc6bcea17d
tree225cd9b44de4288c2213b9155b4a9770aef011fe
parent6802b5ba8234427598abfd9f0163eb5e7c0d6aa8
tree-optimization/95393 - fold MIN/MAX_EXPR generated by phiopt

This makes sure to fold generated stmts so they do not survive
until RTL expansion and cause awkward code generation.

2020-05-29  Richard Biener <rguenther@suse.de>

PR tree-optimization/95393
* tree-ssa-phiopt.c (minmax_replacement): Use gimple_build
to build the min/max expression so we simplify cases like
MAX(0, s) immediately.

* gcc.dg/tree-ssa/phi-opt-21.c: New testcase.
* g++.dg/vect/slp-pr87105.cc: Adjust.
gcc/testsuite/g++.dg/vect/slp-pr87105.cc
gcc/testsuite/gcc.dg/tree-ssa/phi-opt-21.c [new file with mode: 0644]
gcc/tree-ssa-phiopt.c