aboutsummaryrefslogtreecommitdiff
path: root/gcc/gimple-loop-interchange.cc
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-07-01 12:49:45 +0200
committerRichard Biener <rguenther@suse.de>2021-07-01 13:38:59 +0200
commit0a77c07b9b3fe83679358c3ef57721e09e2ad5fb (patch)
tree27e44924fdf36ccf4e2d4bd2f277440e76d08f71 /gcc/gimple-loop-interchange.cc
parent09a7b00ac3075e3544978027f47b68fce54adabb (diff)
downloadgcc-0a77c07b9b3fe83679358c3ef57721e09e2ad5fb.zip
gcc-0a77c07b9b3fe83679358c3ef57721e09e2ad5fb.tar.gz
gcc-0a77c07b9b3fe83679358c3ef57721e09e2ad5fb.tar.bz2
tree-optimization/101280 - revise interchange fix for PR101173
The following revises the original fix for PR101173 to correctly check for a reversed dependence rather than disallowing a zero distance. It also adds a check from TSVC which asks for this kind of interchange (but with a valid dependence). 2021-07-01 Richard Biener <rguenther@suse.de> PR tree-optimization/101280 PR tree-optimization/101173 * gimple-loop-interchange.cc (tree_loop_interchange::valid_data_dependences): Revert previous change and instead correctly handle DDR_REVERSED_P dependence. * gcc.dg/tree-ssa/loop-interchange-16.c: New testcase.
Diffstat (limited to 'gcc/gimple-loop-interchange.cc')
-rw-r--r--gcc/gimple-loop-interchange.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/gcc/gimple-loop-interchange.cc b/gcc/gimple-loop-interchange.cc
index 43045c54..43ef112 100644
--- a/gcc/gimple-loop-interchange.cc
+++ b/gcc/gimple-loop-interchange.cc
@@ -1043,8 +1043,11 @@ tree_loop_interchange::valid_data_dependences (unsigned i_idx, unsigned o_idx,
continue;
/* Be conservative, skip case if either direction at i_idx/o_idx
- levels is not '=' (for the inner loop) or '<'. */
- if (dist_vect[i_idx] < 0 || dist_vect[o_idx] <= 0)
+ levels is not '=' or '<'. */
+ if (dist_vect[i_idx] < 0
+ || (DDR_REVERSED_P (ddr) && dist_vect[i_idx] > 0)
+ || dist_vect[o_idx] < 0
+ || (DDR_REVERSED_P (ddr) && dist_vect[o_idx] > 0))
return false;
}
}