<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/91436>91436</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[DebugInfo][IndVarSimplify] Missing debug location updates of newly created instructions
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Apochens
</td>
</tr>
</table>
<pre>
I've found missing debug location updates in IndVarSimplify Pass (IndVarSimplify[-L358](https://github.com/llvm/llvm-project/blob/6f2997cefc1e32c11a891ede2e3a2d73310e6ce1/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp#L358), [-L363](https://github.com/llvm/llvm-project/blob/6f2997cefc1e32c11a891ede2e3a2d73310e6ce1/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp#L363), [-L368](https://github.com/llvm/llvm-project/blob/6f2997cefc1e32c11a891ede2e3a2d73310e6ce1/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp#L368C3-L370C64), [-L394](https://github.com/llvm/llvm-project/blob/6f2997cefc1e32c11a891ede2e3a2d73310e6ce1/llvm/lib/Transforms/Scalar/IndVarSimplify.cpp#L394)), and used -debugify on the regression test `floating-point-iv.ll` to double check the missing debug locations:
```
WARNING: Instruction with empty DebugLoc in function test1 -- %indvar.conv = sitofp i32 %iv.int to double
WARNING: Instruction with empty DebugLoc in function test1 -- %.int = add nuw nsw i32 %iv.int, 1
WARNING: Instruction with empty DebugLoc in function test1 -- %1 = icmp ult i32 %.int, 10000
WARNING: Instruction with empty DebugLoc in function test2 -- %indvar.conv = sitofp i32 %iv.int to double
WARNING: Instruction with empty DebugLoc in function test2 -- %.int = add nsw i32 %iv.int, 2
WARNING: Instruction with empty DebugLoc in function test2 -- %1 = icmp slt i32 %.int, -1
WARNING: Instruction with empty DebugLoc in function test5 -- %.int1 = add nsw i32 %.int, -1
WARNING: Instruction with empty DebugLoc in function test5 -- %3 = icmp slt i32 %.int1, 0
WARNING: Instruction with empty DebugLoc in function test_max_be -- %indvar.conv = sitofp i32 %tmp11.int to double
WARNING: Instruction with empty DebugLoc in function test_max_be -- %tmp13.int = add nuw nsw i32 %tmp11.int, 1
WARNING: Instruction with empty DebugLoc in function test_max_be -- %tmp14 = icmp ult i32 %tmp13.int, 99999
WARNING: Instruction with empty DebugLoc in function test_max_be2 -- %indvar.conv = sitofp i32 %tmp11.int to float
WARNING: Instruction with empty DebugLoc in function test_max_be2 -- %tmp13.int = add nuw nsw i32 %tmp11.int, 1
WARNING: Instruction with empty DebugLoc in function test_max_be2 -- %tmp14 = icmp ult i32 %tmp13.int, 99999
WARNING: Instruction with empty DebugLoc in function test_max_be3 -- %indvar.conv = sitofp i32 %tmp11.int to float
WARNING: Instruction with empty DebugLoc in function test_max_be3 -- %tmp13.int = add nuw nsw i32 %tmp11.int, 1
WARNING: Instruction with empty DebugLoc in function test_max_be3 -- %tmp14 = icmp ult i32 %tmp13.int, 99999
WARNING: Instruction with empty DebugLoc in function pr55505_remove_redundant_fptosi_for_float_iv -- %indvar.conv = sitofp i32 %float.iv.int to float
WARNING: Instruction with empty DebugLoc in function pr55505_remove_redundant_fptosi_for_float_iv -- %float.iv.next.int = add nsw i32 %float.iv.int, -1
WARNING: Instruction with empty DebugLoc in function pr55505_remove_redundant_fptosi_for_float_iv -- %cmp = icmp ugt i32 %float.iv.next.int, 0
```
The missing debug location of the PHINode is not reported in the debugify's output.
I will patch these missing updates later.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUV11v4jgU_TXm5YrIHzgkDzx0ithF6lajndHuI3JiB7xr7Mh2YPrvV3YHCp121J0ioQIKApN7zj3HF98rQtBrq9QM8U-Iz0diiBvnZze9azfKhlHj5MNsieh0p6Bzg5Ww1SFouwapmmENxrUiamdh6KWIKoC2sLTyL-G_6G1vdPcAn0UIgGh1_jXin8Z3jFeIzxGtNjH2AbEbRBeILtY6boamaN0W0YUxu8PbuP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