-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cranelift-isle: Reject unreachable rules #5322
Conversation
Subscribe to Label Action
This issue or pull request has been labeled: "cranelift", "cranelift:docs", "isle"
Thus the following users have been cc'd because of the following labels:
To subscribe or unsubscribe from this label, edit the |
Most of the s390x instances appear to be of the same pattern:
where it says that the rule with higher priority will always shadow the rule with lower priority. But that's not actually the case because the first rule has an Am I mistaken in my interpretation here, or does the checker not consider (Of course, in these instances, the rules can be rewritten without |
The remaining s390x case also seems a false positive. The higher-priority rule is:
and the lower-priority rule is:
But the higher-priority rule does not always fire, it requires a match of the two operands of the inner |
It should be handling I'll look into both issues tomorrow. Thanks for digging into these! |
Fixing the false positive for Fixing the other issues is turning out to be more of a pain. Naively adding constraints for all uses of fallible constructors effectively disables all overlap checking, because constructors on the right-hand side of the rule shouldn't count, and by convention all our lowerings delegate to other internal constructors. But I think I have a workable plan. |
Now that I've fixed pure constructors, there are no errors left in s390x. Thanks @uweigand! That also fixed most of the aarch64 errors and some of the x64 errors. The new failure output from CI shows:
|
Fix shadowing identified in #5322 for imul and swiden_high/swiden_low/uwiden_high/uwiden_low combinations in the x64 backend, and remove some redundant rules from the aarch64 dynamic neon ruleset. Additionally, add tests to the x64 backend showing that the imul specializations are firing.
91ee255
to
bf51b79
Compare
Some of our ISLE rules can never fire because there's a higher-priority rule that will always fire instead. Sometimes the worst that can happen is we generate sub-optimal output. That's not so bad but we'd still like to know about it so we can fix it. In other cases there might be instructions which can't be lowered in isolation. If a general rule for lowering one of the instructions is higher-priority than the rule for lowering the combined sequence, then lowering the combined sequence will always fail. Either way, this is always a bug, so make it a fatal error if we can detect it.
bf51b79
to
fe5337d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, thanks for pulling all the other PRs out!
Some of our ISLE rules can never fire because there's a higher-priority rule that will always fire instead.
Sometimes the worst that can happen is we generate sub-optimal output. That's not so bad but we'd still like to know about it so we can fix it. On x64, a current example is that lowering the combination of
imul
withswiden_high
will always emit separate machine instructions for each, rather than a single instruction for the combination.In other cases there might be instructions which can't be lowered in isolation. If a general rule for lowering one of the instructions is higher-priority than the rule for lowering the combined sequence, then lowering the combined sequence will always fail. I suspect there aren't any of these because somebody probably would have noticed already, but I don't know.
Either way, this is always a bug, so make it a fatal error if we can detect it.
I'm opening this as a draft because I've made this condition a fatal error without fixing any of the existing instances of that error. I'd like help from folks who are more familiar with the backends to figure out how to fix each case, and maybe write new filetests to exercise the relevant rules.
There are currently:
Details of all these cases are visible in the failure output from CI for this PR.