Hi, This simple patch fixes the ICE by getting loop bbs in dominance order and sorting chain references against it. Previously it didn't take dominance in consideration for loop thus resulted in use-before-def issue. After looking at the code closer, I think sorting references isn't necessary, what we need actually is to find the most dominant reference in the length=0 sub-chain. In other words, we only need a linear scan here, rather than quadratic sorting. I will try to revise it in next Stage1.
Bootstrap and test on x86_64, is it OK? Thanks, bin 2019-01-28 Bin Cheng <bin.ch...@linux.alibaba.com> PR tree-optimization/88932 * tree-predcom.c (try_combine_chains): Get loop bbs in dom order. 2019-01-28 Bin Cheng <bin.ch...@linux.alibaba.com> PR tree-optimization/88932 * gfortran.dg/pr88932.f90: New test.
pr88932.txt
Description: Binary data