Skip to content

#34 does not work correctly when host_triplet = target_triplet#72

Merged
strega-nil-ms merged 1 commit intomicrosoft:mainfrom
strega-nil:host-exclusions-fix
May 14, 2021
Merged

#34 does not work correctly when host_triplet = target_triplet#72
strega-nil-ms merged 1 commit intomicrosoft:mainfrom
strega-nil:host-exclusions-fix

Conversation

@strega-nil
Copy link
Copy Markdown
Contributor

This fixes that bug

Comment on lines +308 to +317
bool excluded = false;
if (spec.triplet() == host_triplet)
{
return Util::Sets::contains(host_exclusions, spec.name());
excluded = excluded || Util::Sets::contains(host_exclusions, spec.name());
}
else
if (spec.triplet() == target_triplet)
{
return Util::Sets::contains(exclusions, spec.name());
excluded = excluded || Util::Sets::contains(exclusions, spec.name());
}
return excluded;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

My optimizer brain hates mixing the control flow domain and the value domain. (Saying 'perf doesn't matter here leave me alone Bill' is a totally OK response :))

How about:

auto&& triplet = spec.triplet();
auto&& name = spec.name();
return (triplet == host_triplet && Util::Sets::contains(host_exclusions, name))
    || (triplet == target_triplet && Util::Sets::contains(exclusions, name));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

perf doesn't matter here leave me alone bill ;)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

To be honest I find the return expression a bit clearer too but 🤷‍♂️

@strega-nil-ms strega-nil-ms merged commit eea14d0 into microsoft:main May 14, 2021
@strega-nil strega-nil deleted the host-exclusions-fix branch March 29, 2025 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants