Bugfix for sharing a self-reference across multiple reduction definitions.

Solved by making a unique copy of each self-reference for each definition.
Replace extract_buffer_extent intrinsic with extract_buffer_max

This gives simpler bounds logic in the presence of extern stages.
Merge branch 'master' of github.com:halide/Halide