http://gcc.gnu.org/bugzilla/show_bug.cgi?id=51752
--- Comment #3 from Aldy Hernandez <aldyh at gcc dot gnu.org> 2012-02-09 16:23:57 UTC --- Created attachment 26622 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26622 proposed (untested) patch This is a first stab at the problem. It is untested, and there are definitely other places that will be perform loads behind our back, but this seems to work for the test at hand. The main gist is saving all blocks that appear in a transaction so later we can know if the load being hoisted is inside a transaction. Then we use ANTIC sets to determine if all paths out of the loop header perform the load. If so, the load is permitted. Again, untested WIP, but hopefully on the right track.