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

[BOLT] Skip functions with unsupported Linux kernel features #86345

Merged
merged 2 commits into from
Mar 22, 2024

Conversation

maksfb
Copy link
Contributor

@maksfb maksfb commented Mar 22, 2024

Do not overwrite functions with alternative and paravirtual instructions until a proper update support is implemented.

Do not overwrite functions with alternative and paravirtual instructions
until a proper update support is implemented.
Copy link

✅ With the latest revision this PR passed the Python code formatter.

Copy link

✅ With the latest revision this PR passed the C/C++ code formatter.

Copy link
Member

@dcci dcci left a comment

Choose a reason for hiding this comment

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

Thanks.

Comment on lines 1144 to 1145
if (!BC.shouldEmit(BF))
break;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (!BC.shouldEmit(BF))
break;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why? That's intentional early break after we mark the function as non-simple in the loop below.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, that's subtle. Then I'd suggest breaking out immediately after BF.setSimple(false) to be explicit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's breaking, just not to the outer loop. I've refactored using llvm::any_of() as you suggested and it looks much cleaner now.

Comment on lines 1146 to 1151
for (const MCInst &Inst : BB) {
if (BC.MIB->hasAnnotation(Inst, "ParaSite")) {
BF.setSimple(false);
break;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with it as-is, but this can help reduce indentation:

Suggested change
for (const MCInst &Inst : BB) {
if (BC.MIB->hasAnnotation(Inst, "ParaSite")) {
BF.setSimple(false);
break;
}
}
bool HasParaSite = llvm::any_of(BB, [&](const MCInst &Inst) { return BC.MIB->hasAnnotation(Inst, "ParaSite"); });
if (HasParaSite)
BF.setSimple(false);

if (!BC.shouldEmit(BF))
continue;
for (const BinaryBasicBlock &BB : BF) {
if (!BC.shouldEmit(BF))
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicate

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's not.

Copy link
Contributor

@aaupov aaupov left a comment

Choose a reason for hiding this comment

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

Perfect.

@maksfb maksfb merged commit 56197d7 into llvm:main Mar 22, 2024
4 checks passed
@maksfb maksfb deleted the gh-skip-unsupported branch March 28, 2024 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants