已开启
[LLVM][AArch64] WeakConsistencyPass 在分支松弛之后插入 dmb sy,大函数中 tbnz 超出 ±32KB 编码范围,汇编报 "fixup value out of range" #135
cactusBalll创建于 8月31日
8月31日 将 alexanderbill、li-yancheng、cf-zhao、eastb233、wangqiang95、kuenking111_admin、SegFault、wd-gitcode、chenzheng1030、gcw_LWQavIsb 设为负责人
8月31日 将 alexanderbill、li-yancheng、cf-zhao、eastb233、wangqiang95、kuenking111_admin、SegFault、wd-gitcode、chenzheng1030、gcw_LWQavIsb 设为负责人
8月31日 添加了label:sig/Compiler
openeuler-ci-bot
8月31日 评论:
8月31日 评论:
Welcome To openEuler Community
Hey @gcw_LWQavIsb , 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. You can self-configure the PR merge rules for this repository. For more details, please refer to Here.
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: @liyunfei33, @zhongyunde .


【缺陷描述】:请补充详细的缺陷问题现象描述
编译一个规模较大但完全合法的函数(repro.c:if/else 菱形结构,then 分支含 8100 个 volatile 加载——
(void)*p++,入口tbnz w0, #0, .LBB0_2的目标距离约 32.4KB,在 tbz/tbnz ±32KB 编码范围内;函数低于 pass 的 9000 条指令上限),启用弱一致性 pass:-relaxed-ordering-level=0|1|2三个启用级别全部失败;默认disable编译正常。机理:pass 在每个 load/store 前插入一条
dmb sy(4 字节),8100 条插入使 tbnz 位移增长约 32.4KB,总位移约 65KB,超出 tbz/tbnz 的 ±32KB 立即数编码范围,一体化汇编器报 fixup 错误。一、缺陷信息
AArch64PassConfig::addPreEmitPass2()(llvm/lib/Target/AArch64/AArch64TargetMachine.cpp:901),而 AArch64 分支松弛 pass 在更早的addPreEmitPass(:887)已经运行;pass 在所有分支偏移已验证/松弛完成之后插桩增长基本块,没有重跑分支松弛【缺陷所属的os版本】
Ubuntu 22.04.3 LTS,缺陷位于编译器/MLIR 工具链本身,与操作系统版本无关。
【内核版本】
6.6.87.2-microsoft-standard-WSL2(uname -r)。缺陷与内核版本无关。
【缺陷所属软件及版本号】
LLVM 20.1.8
【环境信息】
编译选项:
CMAKE_BUILD_TYPE=RelWithDebInfo,LLVM_ENABLE_ASSERTIONS=ON,LLVM_ENABLE_PROJECTS="clang;mlir",LLVM_TARGETS_TO_BUILD="X86;AArch64"
COMMIT ID:35f464110c04e89bd0cab0e3fee4a70ec6ec2eb9
【问题复现步骤】
int big(int n, volatile int *p) { if (!(n & 1)){ (void)*p++; ...(重复至少8100次) (void)*p++; (void)*p++; (void)*p++; } else { (void)*--p; } return 0; }执行
clang --target=aarch64-linux-gnu -mllvm -relaxed-ordering-level=1 -c repro.c(error: fixup value out of range)【实际结果】
【期望结果】
【其他相关附件信息】
【缺陷详情及分析指导参考链接】