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 as part of the atomic transaction, 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 to be executed as an atomic transaction, wherein the alternate sequence of instructions performs the plurality of accesses and is executable to implement within the atomic transaction: storing results of one or more of the accesses to the shared memory location in a shadow location in thread-local memory, wherein said storing comprises storing in the shadow location a value to be written to, or read from, the shared memory location, based on the one or more accesses; performing one of the accesses of the original sequence of instructions to the shared memory location using a non-transactional memory access within the atomic transaction 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.