https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61517
--- Comment #3 from thopre01 at gcc dot gnu.org --- Author: thopre01 Date: Wed Jun 18 10:43:50 2014 New Revision: 211778 URL: https://gcc.gnu.org/viewcvs?rev=211778&root=gcc&view=rev Log: 2014-06-18 Thomas Preud'homme <thomas.preudho...@arm.com> gcc/ PR tree-optimization/61517 * tree-ssa-math-opts.c (find_bswap_or_nop_1): Adapt to return a stmt whose rhs's first tree is the source expression instead of the expression itself. (find_bswap_or_nop): Likewise. (bsap_replace): Rename stmt in cur_stmt. Pass gsi by value and src as a gimple stmt whose rhs's first tree is the source. In the memory source case, move the stmt to be replaced close to one of the original load to avoid the problem of a store between the load and the stmt's original location. (pass_optimize_bswap::execute): Adapt to change in bswap_replace's signature. gcc/testsuite/ * gcc.c-torture/execute/bswap-2.c (incorrect_read_le32): New. (incorrect_read_be32): Likewise. (main): Call incorrect_read_* to test stmt replacement is made by bswap at the right place. * gcc.c-torture/execute/pr61517.c: New test. Added: trunk/gcc/testsuite/gcc.c-torture/execute/pr61517.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.c-torture/execute/bswap-2.c trunk/gcc/tree-ssa-math-opts.c