------- Comment #28 from bonzini at gnu dot org 2008-08-07 05:01 ------- fwprop seems the right place to do that indeed.
Only thing, I wonder you need to "find a location to add the constant": it could be enough to do *x = simplify_gen_binary (PLUS, Pmode, *x, cst_to_add); because simplify_plus_minus should have machinery to do what you are doing already. Indeed I wonder if this code shouldn't go in simplify_plus_minus so that propagate_rtx would call it automatically. Also when you compute cst_to_add you can use the _const_ version of the simplification routine. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29256