// p and q may or may not point at the same object.
int i = p.x;
// ... maybe another thread writes p.x at this point ...
int j = q.x;
int k = p.x;

在这个程序中,公共子表达式消除(common subexpression elimination)会注意到 p.x 被计算了两次,并将最后一行优化为 k = i