Basic coerce optimization - #1798
Merged
Merged
Conversation
it's triggering a _lot_ on (coerce x 'real) which khazern generates for e.g. maximize clauses. That's weird but totally valid so the warning is spurious. I checked SBCL and it has some pretty complex logic for when to warn, mostly based on when it can confirm the coercion is impossible because the argument is definitely not of the result type.
our subtypep gives up and dies on nontrivial cons types, so for example, a transform specialized on (T T) failed because (subtypep 'type-specifier 't) gave NIL NIL. No good! Has that typep transform even been firing? I guess not. Really need better explainability as well
broken cons types are annoying. I want everything to be a known subtype of T at minimum
CLHS says this check is always first, by my reading, so this reduction is valid even with the weird COMPLEX stuff. Khazern generates a lot of (coerce foo 'real) for MAXIMIZE clauses so it's good to take care of this obvious stuff.
i don't know why i thought FLOAT would mess with floats?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Optimizes out
(coerce (the thing x) 'thing), since I noticed Khazern does that a lot. Also silences the "can't coerce to REAL" type warnings until we have sophisticated enough machinery to note genuinely invalid coercions.Also special cases
(subtypep foo 't)because the Baker subtypep is really bad (conformance-breakingly, even) on cons types.