Skip to content
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

Preserve the original name when renaming declarations in the inlining pass. #4683

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

fruffy
Copy link
Collaborator

@fruffy fruffy commented May 27, 2024

Fixes #4444.

@fruffy fruffy added the core Topics concerning the core segments of the compiler (frontend, midend, parser) label May 27, 2024
@ChrisDodd
Copy link
Contributor

The differences in the DPDK output indicates that that backend may be incorrectly using the name of a symbol when it should be using the externalName. This change is causing it to use the unqualified name instead of a the fully qualified name.

@fruffy
Copy link
Collaborator Author

fruffy commented Jun 3, 2024

The differences in the DPDK output indicates that that backend may be incorrectly using the name of a symbol when it should be using the externalName. This change is causing it to use the unqualified name instead of a the fully qualified name.

Yes, the DPDK uses originalName a lot. I do not know why. Unfortunately, the developers responsible have left Intel it seems.

@hanw Do you know whether there is still someone involved with the DPDK back end?

Copy link
Contributor

@vlstill vlstill left a 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.


public:
void setNewName(const IR::IDeclaration *decl, cstring name, cstring extName) {
CHECK_NULL(decl);
BUG_CHECK(!name.isNullOrEmpty() && !extName.isNullOrEmpty(), "Empty name");
LOG3("setNewName " << dbp(decl) << " to " << name);
if (internalName.find(decl) != internalName.end()) BUG("%1%: already renamed", decl);
internalName.emplace(decl, name);
externalName.emplace(decl, extName);
internalName.emplace(decl, IR::ID(name, decl->toString()));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we shuld rather do something like decl->name.originalName here? Using toString might be fragile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Topics concerning the core segments of the compiler (frontend, midend, parser)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RenameMap in inlining.cpp does not preserve the original variable name.
3 participants