Register allocator: Stale content after spill operations
还没有人认领这个 Issue。
评估
调研方向
Start in src/reg-alloc.c at the TODO about outdated register content after store operations, then reproduce the issue with the provided test_spill_bug pattern under register pressure. Trace spill, store, and later value access paths. Done means spilled values are invalidated or versioned so subsequent uses load fresh memory values and the reproducer returns the correct result.
由索引模型根据 Issue 内容生成。
描述
Description
The register allocator has a critical bug where register content becomes stale after spill operations, potentially causing incorrect program behavior.
Current Behavior
- When registers are spilled to memory, the allocator doesn't properly track that the register content is outdated
- This can lead to using stale values from registers instead of loading fresh values from memory
Expected Behavior
After a spill operation, the register allocator should mark the register content as invalid and ensure fresh loads from memory when the value is needed again.
Location in Code
- Primary location:
src/reg-alloc.c - Comment in code: "TODO: Outdated register content after store operations needs proper handling to prevent using stale values"
Impact
- CRITICAL: Can cause incorrect program execution
- Affects correctness of compiled programs
- May produce subtle bugs that are hard to debug
Test Case
// This pattern can trigger the stale register bug
int test_spill_bug(int a, int b, int c, int d, int e, int f, int g, int h) {
// Force register pressure to cause spills
int t1 = a + b;
int t2 = c + d;
int t3 = e + f;
int t4 = g + h;
int t5 = t1 * t2;
int t6 = t3 * t4;
// Modify spilled values
t1 = t1 + 100;
t3 = t3 + 200;
// Use potentially stale register values
return t1 + t2 + t3 + t4 + t5 + t6;
}
Proposed Solution
- Track register validity state after spills
- Force reload from memory when accessing previously spilled values
- Add register content versioning or invalidation mechanism
Severity
HIGH - This is a correctness issue that can cause wrong program behavior
- 主要语言
- C
- 星标
- 1.4k
- 派生
- 168
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 5
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
sysprog21/shecc 的其他 Issue
-
enhancement
难度 5/5 一周以上 新手友好度 30/100
-
Import a GitHub Action for benchmarking purposes可能已有人在做 @DrXiao 于 446 天前认领。 未关闭
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
yunusemreyl/omen-space#337 ·
维护者通常 1 天内回复
-
dependency component: oneMKL module: dpclang
难度 2/5 1-3 小时 新手友好度 82/100
intel/torch-xpu-ops#5880 ·
维护者通常 2 天内回复