Hi, For now, loop distribution handles variables used outside of loop as reduction. This is inaccurate because all partitions contain statement defining induction vars. Ideally we should factor out scev-propagation as a standalone interface which can be called when necessary. Before that, this patch simply workarounds reduction issue by checking if the statement belongs to all partitions. If yes, the reduction must be computed in the last partition no matter how the loop is distributed. Bootstrap and test on x86_64 and AArch64. Is it OK? Thanks, bin 2017-06-07 Bin Cheng * tree-loop-distribution.c (classify_partition): New parameter and better handle reduction statement. (rdg_build_partitions): New parameter and record statements belonging to all partitions. (distribute_loop): Update use of above functions.