ArtifactValueFinder keeps trying to combine g_unmerge_values in some cases.
Fix is to skip combine attempt for dead defs.
Details
Diff Detail
Unit Tests
Event Timeline
My best guess is that this happens when dead-def can be found by looking through insert but there is nothing to replace with the value we found.
TODO: avoid using G_INSERT.
llvm/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h | ||
---|---|---|
770 | If the def is dead, we should also set the dead bit in DeadDefs. |
Mark dead bit in DeadDefs and add mir test. MIR in last two tests is from just before artifact combiner. In one we can see dead def in unmerge, other has only dbg use.
llvm/test/CodeGen/AMDGPU/GlobalISel/bug-legalization-artifact-combiner-dead-def.mir | ||
---|---|---|
115–116 | With use_nodbg_empty, this will look like DBG_VALUE %dbg_use(s32) because we skip combine (replace register with found value). It also seems wrong to mark register as dead in that case. Should we treat DBG instrs in special way in this combine? |
llvm/test/CodeGen/AMDGPU/GlobalISel/bug-legalization-artifact-combiner-dead-def.mir | ||
---|---|---|
115–116 | If we don't ignore the debug user, then we could have potentially differing codegen between release and debug builds. |
By the way, I just refactored some of this code in f984b0e177f8 but it's just a case of moving your change to a different function.
Probably should be use_nodbg_empty