On August 18, 2017 6:20:42 AM PDT, Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> wrote: >Hi Josh, > >I was thinking lately about sparse's context checking. >I had an idea and I wondered if it hasn't already been >tried or discussed. > >The context checking essentially works with the instruction >OP_CONTEXT, that do nothing more than adding or subtracting >some constant value to 'the context'. Then, at checking time, >these instructions are interpreted along all the paths and if >there is a disagreement between values from different paths, >it emits a 'context imbalance' warning (there is also the >checks for the expected return value of the context). > >My idea/question is the following: this interpretation >is already done for all 'normal' values. So couldn't we >consider the context as a special kind of 'variable', >use a normal pseudo for it, use phi-nodes on them and >let the normal simplification process act on them? >If the context is (proveably) well balanced, there >shouldn't be any phi-node left for this context. > >I'm not sure if there would be any significant advantage, >but it seems to me that what is currently done is >somehow redundant with the 'normal' processing. >It could also maybe help to have several independent >contexts. I'd love to see sparse doing more general value tracking, for this and other purposes. And yes, that would help with tracking multiple contexts. -- To unsubscribe from this list: send the line "unsubscribe linux-sparse" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html