This transformation reassociates a n-ary add so that the add can partially reuse
existing instructions. For example, this pass can simplify
void foo(int a, int b) {
bar(a + b);
bar((a + 2) + b);
}to
void foo(int a, int b) {
int t = a + b;
bar(t);
bar(t + 2);
}saving one add instruction.
Fixes PR22357 (https://llvm.org/bugs/show_bug.cgi?id=22357).
Since you're using PatternMatch in only one function, I think the namespace should be opened in just that scope.