freenode/#sbcl - IRC Chatlog
Search
17:31:59
stassats
casts can act as a some sort of serialiser, sort of a let, and we delete those freely
17:32:41
stassats
can some code be constructed where that deletion is wrong, similar to the recent (values x) problem
17:33:54
stassats
and casts, and inlining, and maybe other optimizations make any lvar substitution with multiple writes to the lvar probably infeasible
18:10:08
stassats
there is a provision for that in substitute-single-use-lvar, if the destination of a cast is multi-used, it's not substituted
18:35:14
stassats
trying to use local functions doesn't break, because that's reduced to a LET and then substitute-single-use-lvar is used again
18:35:52
stassats
so, the solution, when a cast is deleted it can't simply disappear, it needs to be replaced with a LET
18:40:50
stassats
ha, there's even a comment (this will be insufficient if we have a CAST-CAST chain, but works well for a single CAST)
18:49:44
stassats
i also really like my test case, it's not some random jumble, but a deliberate attempt at fooling the compiler
19:01:22
stassats
reduced it a bit https://gist.github.com/stassats/f79b0c6fb9b72acfad33e8cf4e84d41d#file-cast-lisp
19:26:24
stassats
alright, (the type x) => (let ((z x)) z) when TYPE is known to be true does fix this
19:41:28
stassats
and LET only works for single values, so, the CAST should be checked if the LVAR has multiple uses, then either delete or mark the cast is now used for value semantics, not for type checking