-
-
Notifications
You must be signed in to change notification settings - Fork 15k
Addition of Option<NonZero*> can compile suboptimally #81342
Copy link
Copy link
Open
Labels
A-result-optionArea: Result and Option combinatorsArea: Result and Option combinatorsC-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
A-result-optionArea: Result and Option combinatorsArea: Result and Option combinatorsC-optimizationCategory: An issue highlighting optimization opportunities or PRs implementing suchCategory: An issue highlighting optimization opportunities or PRs implementing suchE-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.I-slowIssue: Problems and improvements with respect to performance of generated code.Issue: Problems and improvements with respect to performance of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
I'm fairly certain
fooandbarare equivalent (though let me know if I'm overlooking something!):(Playground)
but the compilation of
barseems suboptimal (current stable, 1.49.0):Same result with 1.51.0-nightly (2021-01-23 4d0dd02).
In particular, the middle
testq/cmoveqpair -- immediately preceding theleaq-- seem entirely redundant unless I'm missing something, as:movq,rcxis equal tordi.cmoveq,rcxis therefore either equal tordi, or 0,cmoveqmovesrdiintorcxwhenrdiis 0. But whenrdiis 0,rcxmust already be 0.I played around with some other
NonZero*types (including some signed) and observed the same pattern.