1. A compiler system for compiling source code comprising: a library of code patterns and control flow information for each code pattern in the library, wherein each code pattern comprises one or more variables; and a processor arranged to: evaluate a control flow of an expression in the source code, wherein the expression comprises one or more variables, match the expression to one of the code patterns in the library based on the evaluated control flow information and the control flow information of one of the code patterns in the library, assign value numbers to the one or more variables within the expression, determine if the expression and the matched code pattern are equivalent based on the assigned value numbers, wherein the equivalence is determined by verifying that value number propagation in the expression is equivalent to the value number propagation in the matched code pattern, and replace the expression with a replacement expression if the expression and the matched code pattern are equivalent based on the assigned value numbers.