On 12 March 2017 at 20:30, Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx> wrote: > On Sat, Mar 11, 2017 at 04:47:21PM +0100, Luc Van Oostenryck wrote: >> This is a RFC for giving a type to constants/PSEUDO_VALs. >> >> Not having this info if fine for the linearization/simplification >> but is quite painful once trying to generate code of it. >> >> This serie try to do this by: >> - shuffling some fields in struct pseudo to allow >> PSEUDO_VAL to have the ::sym field too without >> without increasing the size of the structure. >> - mechanically initialize each PSEUDO_VAL's ::sym >> with the appropriate type. >> >> This serie have been tested on the test suite only. >> Thsi serie also doesn't make any use yet of this type info. > > I have begun to try to make use of this and I'm now convinced > that this direction is not a viable solution for sparse. > > Sparse's IR is slightly lower-level that LLVM's IR, more close > to what a real CPU would do. This can already be seen at some > instructions (nothing like GEP in sparse), the real difference > is less obvious but it's heer that things begin to hurt. > Indeed, sparse's CPU-like model implies that values are typeless > but have a size and sparse's CSE and simplification is heavily > based on this. > Once you try to add and maintain complete and correct typing to > sparse's instructions so that they can be used easily by sparse-llvm > you realize that: > - you need to add a lot more casts > - you need to change CSE to make things equivalent only if they > have the same type > - a lot of simplifications are wrong, some can be corrected by adding > even more casts. > > So, while I'm very fine to add typing info where it was missing, > I have no interest in making the simplifications more complex and > of lesser quality. > I do not know / understand enough to comment on this but I find that your patches are working well for sparse-llvm. In particular without the type information in constants, I cannot see how variadic functions can be called correctly. If the changes done so far haven't broken anything then perhaps they can be left in? Regards Dibyendu -- 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