fix(mir): GPR32/GPR64别名检查移除segments.empty()条件

Wn和Xn是同一硬件寄存器(如W12和X12),GPR32和GPR64 vreg
在同一phys_reg上总是冲突,无论segments是否为空。
原代码要求!segments.empty(),导致某些情况下别名冲突被漏检。

参考: AArch64寄存器别名机制,Wn为Xn的低32位
lzk
lzkk 3 days ago
parent 5fb106bde8
commit 83228a8123

@ -482,7 +482,7 @@ bool LiveRegMatrix::CheckInterference(const LiveInterval &li, int phys_reg) cons
bool gpr32_64_alias =
(li.reg_class == RegClass::GPR32 && other->reg_class == RegClass::GPR64) ||
(li.reg_class == RegClass::GPR64 && other->reg_class == RegClass::GPR32);
if (gpr32_64_alias && !li.segments.empty() && !other->segments.empty())
if (gpr32_64_alias)
return true;
for (auto &sa : li.segments)
for (auto &sb : other->segments)
@ -501,7 +501,7 @@ LiveInterval *LiveRegMatrix::GetConflict(const LiveInterval &li,
bool gpr32_64_alias =
(li.reg_class == RegClass::GPR32 && other->reg_class == RegClass::GPR64) ||
(li.reg_class == RegClass::GPR64 && other->reg_class == RegClass::GPR32);
if (gpr32_64_alias && !li.segments.empty() && !other->segments.empty())
if (gpr32_64_alias)
return other;
for (auto &sa : li.segments)
for (auto &sb : other->segments)

Loading…
Cancel
Save