-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Runtime code is generated for functions only used in const eval #119214
Copy link
Copy link
Open
Labels
C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.I-heavyIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to binary size 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
C-discussionCategory: Discussion or questions that doesn't represent real issues.Category: Discussion or questions that doesn't represent real issues.I-heavyIssue: Problems and improvements with respect to binary size of generated code.Issue: Problems and improvements with respect to binary size 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.
Code
I tried this code:
I expected to see this happen: Both
check1andcheck2should compile to functions that just use a compiletime-evaluated struct valueInstead, this happened:
check1disapeared from the assembly, and it looks like all the code needed to runtime-evaluate it got added insteadThe weird thing is that the function that regressed is the one that uses a
constitem by name, rather than the one that just calls a const function inside a non-const function body.Version it worked on
It most recently worked on: 1.74.1 (stable as of writing this)
Version with regression
from playground: