> insn 882 : cc <- compare (r684, 0) > jump_insn 883 : if (cc != 0) goto insn 46 > insn 49 : r291 <- r684 > ...... > insn 46 > > cc contains the result of subtracting 0 from r684; control flow goes to > insn_49 only if (cc == 0), which implies (r684 == 0). > Then at insn_49 we have conditional const propagation "r684 <- 0", is it > right? >
I believe, the optimization you may be referring to is value range propagation which does predication of values based on predicates of conditions. GCC definitely applies VRP at the tree stage, I am not sure if there is an RTL pass to do the same.