An efficient static analysis algorithm to detect redundant memory operations