Displaying 1 result from an estimated 1 matches for "subexpresion".
Did you mean:
subexpression
2017 Oct 25
2
[PATCH/RFC] Modifying reassociate for improved CSE: fairly large perf gains
...n gcc or ICC.
Consider the following trivial function:
void foo(int a, int b, int c, int d, int e, int *res) {
res[0] = (e * a) * d;
res[1] = (e * b) * d;
res[2] = (e * c) * d;
}
This function can be optimized down to 4 multiplies instead of 6 by reassociating such that (e*d) is the common subexpresion. However, no compiler I’ve tested does this. I wrote a slightly hacky heuristic algorithm to augment reassociate to do this and tested it.
First, before the details, the results: on a large offline test suite of graphics shaders it cut down total instruction count by ~0.9% (!) and float math instr...