Optimisation: What is Partial Redundancy Elimination

Partial redundancy elimination aims to reduce the cases in code where the same calculation is repeated without a good reason.

This is similar to common subexpression elimination but allows for working with cases where the calculation may be redundant on some but not all of the active paths through the function.

Example:
x = a + b;
y = a + b;
if(z)
z = a + b

Becomes
t = a + b
x = t
b = t
if(z)
z = t