1. A method, comprising: performing by a computer: analyzing source code that comprises a sequence of instructions to be executed as an atomic transaction, wherein the sequence of instructions comprises instructions for performing a plurality of accesses to a shared memory location, wherein the shared memory location is accessible to a plurality of atomic transactions; and replacing the sequence of instructions with an alternate sequence of instructions, wherein the alternate sequence of instructions is executable to implement: storing results of one or more of the accesses to the shared memory location in a shadow location in thread-local memory; performing one of the accesses to the shared memory location using a non-transactional memory access that targets the shadow location; and performing a different one of the accesses to the shared memory location using a transactional memory access that targets the shared memory location.