Looking at the examples for gcc SLP reduction I see that the reduction variable is defined outside the loop. It's OK to have this as an example, I thought. However, looking at the actual implementation I found out that this is the ONLY SLP reduction gcc does.
/* Detect SLP reduction of the form: #a1 = phi <a5, a0> a2 = operation (a1) a3 = operation (a2) a4 = operation (a3) a5 = operation (a4) #a = phi <a5> PHI is the reduction phi node (#a1 = phi <a5, a0> above) FIRST_STMT is the first reduction stmt in the chain (a2 = operation (a1)). Return TRUE if a reduction chain was detected. */ Is there any reasoning behind this other than that the loop-aware one is generally more profitable? -- Thanks, Anton