已合并
[CFGO] Do not enable -fselective-scheduling #386
[CFGO] Do not enable -fselective-scheduling #386
已合并
rfwang07创建于 8月6日
rfwang07
rfwang07
8月6日

PR功能描述 / 为什么需要这个合入:

希望检视人员了解的内容:

Checklist:
PR格式

功能验证

likedislike
Pull Request已成功合入, 合并人@openeuler-ci-bot
(感谢 rfwang07 的贡献)
rfwang07rfwang07
8月6日 创建了 pull request,commit 026189a6
atomgit-bot
atomgit-bot
8月6日 评论:

变更摘要

此 PR 从 enable_cfgo_optimizations 函数中移除了对 -fselective-scheduling 的默认启用,原因是该选项在 aarch64 架构上与 profile instrumentation(-fcfgo-profile-generate / -fcfgo-profile-use)配合时会导致静默生成错误代码——整条语句被无声消除且无崩溃或诊断信息。移除后,用户仍可通过显式传递 -fselective-scheduling 来手动启用该选项,因为 SET_OPTION_IF_UNSET 会尊重已显式设置的选项值。

主要改动

  • 移除 flag_selective_scheduling 的默认启用:在 enable_cfgo_optimizations 中删除了 SET_OPTION_IF_UNSET (opts, opts_set, flag_selective_scheduling, value); 调用,不再随 CFGO 优化路径自动开启该选项。
  • 添加详细注释说明移除原因:用一段多行注释记录了 -fselective-scheduling 在 aarch64 上与 profile instrumentation 组合导致错误代码的具体场景,并指出两者单独使用均正常、组合才触发问题,同时说明影响范围覆盖 -fcfgo-profile-generate 和 -fcfgo-profile-use 两个路径。
  • 保留用户显式启用的能力:注释中明确说明 SET_OPTION_IF_UNSET 的语义保证了用户显式传递 -fselective-scheduling 时仍会生效,无需额外处理。
likedislike
不准确?
atomgit-bot
atomgit-bot
8月6日 评论:

代码审查

✅ 未发现问题

likedislike
不准确?
openeuler-ci-botopeneuler-ci-bot成员
8月6日 将alexanderbill,li-yancheng,cf-zhao,eastb233,wangqiang95,kuenking111_admin,SegFault,wd-gitcode,chenzheng1030设为审查人
openeuler-ci-botopeneuler-ci-bot成员
8月6日 添加了label:sig/Compiler
openeuler-ci-bot
openeuler-ci-bot成员
8月6日 评论:

Welcome To openEuler Community

Hey @rfwang07 , thanks for your contribution to the community.

Bot Usage Manual

I'm the Bot here serving you. You can find the instructions on how to interact with me at Here . That means you can comment below every pull request or issue to trigger Bot Commands.

Contact Guide

If you have any questions, please contact the SIG: Compiler ,
and any of the maintainers: @SegFault, @alexanderbill, @cf-zhao, @chenzheng1030, @eastb233, @kuenking111_admin, @li-yancheng, @wangqiang95, @wd-gitcode ,
and any of the committers: @huang-xiaoquan, @huzife, @lin-4682, @xiongzhou4 .

likedislike
openeuler-ci-botopeneuler-ci-bot成员
8月6日 添加了label:openeuler-cla/yes
openeuler-ci-bot
openeuler-ci-bot成员
8月6日 评论:

CLA Signature Pass

rfwang07, thanks for your pull request. All authors of the commits have signed the CLA. 👍

likedislike
zhuzhibiao1
8月6日 评论:

一般 Minor

AI 代码审阅

优点

  • 修复了关键的正确性问题:该 PR 禁用了 -fselective-scheduling 在 CFGO (自定义反馈驱动优化) 场景下的自动启用,避免了该选项与 profile instrumentation 组合使用时在 aarch64 上产生静默错误代码(整条语句消失)。
  • 详细且清晰的注释:添加的注释准确解释了禁用原因、触发场景(-fcfgo-profile-generate 和 -fcfgo-profile-use)以及用户如何显式传递该选项,大幅提升了代码的可维护性。
  • 改动最小化且安全:使用 SET_OPTION_IF_UNSET 宏的行为,仅移除了该选项的默认设置,完全保留了用户显式启用或禁用的能力,不会破坏现有工作流。
  • 不引入编译或逻辑错误:删除行是 SET 宏调用,无其他依赖,不影响其他优化选项的设置顺序,对编译本身无副作用。

变更文件覆盖检查

  • gcc/opts.cc: 无已证明问题,改动符合预期,注释充实,逻辑正确。

需要修改的问题

未发现明确必须修改的问题。

可优化建议

  • 建议:确认该修改对使用 CFGO 但未显式传递 -fselective-scheduling 的基准性能是否可接受,并在相关测试配置中增加一个用例,验证 profile-generate 阶段不再产生错误代码。
  • 原因:虽然注释说明该选项是实验性的且已知有 bug,但移除它可能对调度优化有轻微性能影响,最好通过实际测量和测试保证无性能显著退化。
  • 示例:
    # 建议在 deja 测试套或单独脚本中加入:
    # 使用 -fcfgo-profile-generate 编译并运行,检查输出正确性
    # 并对比是否由于缺少 selective scheduling 导致性能下降阈值之外
    
    (具体用例需适配 GCC 测试框架)

审阅结论

Severity: 通过

Conclusion: 建议通过

结论说明: 改动明确解决了一个正确性 bug,注释详尽,不影响用户显式选择,不引入编译或运行时错误。未发现代码层面的必改问题,可合入。


Review metadata:

  • PR: #386
  • Latest commit: cf95121b055ae95b200fb94e531b773f2ecc6d23
  • Changed lines: 10
  • Review mode: full
  • Reviewed files: 1/1
likedislike
openeuler-ci-botopeneuler-ci-bot成员
8月6日 添加了label:ci_processing
openeuler-ci-bot
openeuler-ci-bot成员
8月6日 评论:

门禁正在运行, 您可以通过以下链接查看实时门禁检查结果.
若您对门禁结果含义不清晰或者遇到问题不知如何解决,可参考门禁指导手册
门禁入口及编码规范检查: multiarch/openeuler/trigger/gcc/91/console

likedislike
openeuler-ci-botopeneuler-ci-bot成员
8月6日 删除了label:ci_processing
openeuler-ci-bot
openeuler-ci-bot成员
8月6日 评论:
Check Name Build Result 详情 Build Details
check_code ✅SUCCESS #91
check_package_license ✅SUCCESS
x86_64 check_build ✅SUCCESS #99
aarch64 check_build ✅SUCCESS #91
likedislike
openeuler-ci-botopeneuler-ci-bot成员
8月6日 添加了label:ci_successful
openeuler-ci-bot
openeuler-ci-bot成员
8月6日 评论:
likedislike
编译中伙
编译中伙成员
8月7日 评论:

/lgtm
/approve

likedislike
openeuler-ci-botopeneuler-ci-bot成员
8月7日 添加了label:approvedlgtm
openeuler-ci-bot
openeuler-ci-bot成员
8月7日 评论:

Review Code Feedback

  • The label lgtm, approved was added to this pull request. It means that li-yancheng reviewed the code changes. 👋
Tips
  • If this pull request is not merged while all conditions are met, comment /check-pr to try again. 😄
likedislike
openeuler-ci-botopeneuler-ci-bot成员
8月7日 合入了pull request,合并节点 SHA:ad4a09b777b249f8eec83ca03508b86d645fcc1b