aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-phiopt.cc
diff options
context:
space:
mode:
authorTamar Christina <tamar.christina@arm.com>2022-08-30 07:49:02 +0100
committerTamar Christina <tamar.christina@arm.com>2022-08-30 07:49:02 +0100
commit37ebaabde2b88d446369240ae8f03b8e6a284a7b (patch)
tree816123da04540cc74381273c073e775aaa8d086c /gcc/tree-ssa-phiopt.cc
parent368dbb23c5efaf86b2b18945508d379713c0d12c (diff)
downloadgcc-37ebaabde2b88d446369240ae8f03b8e6a284a7b.zip
gcc-37ebaabde2b88d446369240ae8f03b8e6a284a7b.tar.gz
gcc-37ebaabde2b88d446369240ae8f03b8e6a284a7b.tar.bz2
middle-end: fix min/max phiopts reduction [PR106744]
This corrects the argument usage to use them in the order that they occur in the comparisons in gimple. gcc/ChangeLog: PR tree-optimization/106744 * tree-ssa-phiopt.cc (minmax_replacement): Correct arguments. gcc/testsuite/ChangeLog: PR tree-optimization/106744 * gcc.dg/tree-ssa/minmax-10.c: Make runtime test. * gcc.dg/tree-ssa/minmax-11.c: Likewise. * gcc.dg/tree-ssa/minmax-12.c: Likewise. * gcc.dg/tree-ssa/minmax-13.c: Likewise. * gcc.dg/tree-ssa/minmax-14.c: Likewise. * gcc.dg/tree-ssa/minmax-15.c: Likewise. * gcc.dg/tree-ssa/minmax-16.c: Likewise. * gcc.dg/tree-ssa/minmax-3.c: Likewise. * gcc.dg/tree-ssa/minmax-4.c: Likewise. * gcc.dg/tree-ssa/minmax-5.c: Likewise. * gcc.dg/tree-ssa/minmax-6.c: Likewise. * gcc.dg/tree-ssa/minmax-7.c: Likewise. * gcc.dg/tree-ssa/minmax-8.c: Likewise. * gcc.dg/tree-ssa/minmax-9.c: Likewise.
Diffstat (limited to 'gcc/tree-ssa-phiopt.cc')
-rw-r--r--gcc/tree-ssa-phiopt.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/tree-ssa-phiopt.cc b/gcc/tree-ssa-phiopt.cc
index d5f2ba8..925bd7d 100644
--- a/gcc/tree-ssa-phiopt.cc
+++ b/gcc/tree-ssa-phiopt.cc
@@ -2150,9 +2150,9 @@ minmax_replacement (basic_block cond_bb, basic_block middle_bb, basic_block alt_
gimple_seq stmts = NULL;
tree phi_result = PHI_RESULT (phi);
result = gimple_build (&stmts, locus, minmax, TREE_TYPE (phi_result),
- arg0, bound);
+ arg0, arg1);
result = gimple_build (&stmts, locus, ass_code, TREE_TYPE (phi_result),
- result, arg1);
+ result, bound);
if (invert)
result = gimple_build (&stmts, locus, BIT_NOT_EXPR, TREE_TYPE (phi_result),
result);