Hi, On 02/01/2016 13:18, Bernd Schmidt wrote: > On 01/29/2016 08:42 PM, Bernd Edlinger wrote: > > Usually we have "if (x==1234) { read MEM[FP+x]; }", so wo don't know, > > and then after reload: "if (x==1234) { read MEM[SP+x+sp_fp_offset]; }" > > but wait, in the if statement we know, that x==1234, so everything > > turns in one magic constant, and we have a totally new constant offset > > from the SP register "if (x==1234) { read MEM[SP+1234+sp_fp_offset]; }". > > Now if rtx_addr_can_trap_p(MEM[SP+1234+sp_fp_offset]) says it cannot > > trap we think we do not need the if at all => BANG. > > What are you trying to say here? As far as I can tell this isn't a > problem with my proposed solution (set MEM_NOTRAP_P for valid SFP+x > offsets).
First, I think there are cases when x is still a pseudo before reload, and after reload, some constant propagation manages to replace x with a constant value. Then it will not help to know what rtx_addr_can_trap_p was before reload. Second, I do also think that it may be helpful to annotate the RTX during reload. MEM_NOTRAP_P is already used, so maybe something new like a spare bit would be necessary. But maybe a single bit will not be enough, what I would need, would be to somehow annotate the stack_pointer_rtx, that it has a known constant offset to the initial stack pointer value. The problem with that is, that stack_pointer_rtx is a shared pointer, and it is therefore not possible to modify it, and attach some context to it. Bernd.