Fix bugs in the coalesce and simplify logic.

The coalesce logic was not building new repeats and captures correctly.
The simplify logic was not building new captures correctly.

Change-Id: I5a7edebada030c909d13253b43afcaa14bb9aada
Reviewed-on: https://code-review.googlesource.com/3273
Reviewed-by: Paul Wankadia <junyer@google.com>
2 files changed