This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
I initially thought that the best solution for these problems was going to be to move the forwprop pass. While that approach looked appealing (and still has some overall appeal), it's no longer my preferred approach. Basically it's unclear at this time if it's really going to be better or if it's just going to trade one set of missed micro optimizations for another set of missed micro optimizations. So I went back and revisited VRP in the hope of finding a way to safely and efficiently implement the backwards propagation of non-null ranges through pointer typecasts. For those not familiar with VRP and the propagation engine it uses, it is *critical* that we not go backwards through the lattice. ie, once something is VR_VARYING, it does not go back to VR_RANGE or VR_ANTI_RANGE. It is also important to not generate lots of useless ASSERT_EXPRs from a compile-time performance standpoint. For example, if a pointer is used once and only once in a dereference, we do not want to generate an ASSERT_EXPR for it claiming it has a non-null range. Note this need makes it virtually impossible to perform the backwards propagation after the propagation engine has run (we won't have ASSERT_EXPRs for the key pointers and thus no ranges for them). The good news is initial discovery of non-null pointers occurs before the VRP propagation engine runs. If we could do the backwards propagation during that initial non-null discovery, then we would have a fighting chance. And that's exactly what this patch does. With this patch we always attempt to infer a value range, even for single use operands -- note carefully that we still suppress creating ASSERT_EXPRs for such operands to avoid compile time regressions. When we discover a non-null pointer, we then walk up its use-def chain to see if the pointer was set via a NOP_EXPR type conversion from another pointer type. If we find such a type conversion and the source pointer for that type conversion is used more than once, then we register an ASSERT_EXPR for the source pointer in the NOP_EXPR. This fixes two of the three gcc.dg/tree-ssa missed optimization regressions as well as the one reported for C++. Bootstrapped and regression tested on i686-pc-linux-gnu.
Attachment:
PPP
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |