<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/97282>97282</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[DebugInfo][SimplifyIndVar] Missing debug location updates for div/rem instructions
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
svs-quic
</td>
</tr>
</table>
<pre>
There are three instances where the debug information has not been propagated to the new div/rem instructions:
```
bool SimplifyIndvar::eliminateSDiv(BinaryOperator *SDiv) {
auto *UDiv = BinaryOperator::Create(
BinaryOperator::UDiv, SDiv->getOperand(0), SDiv->getOperand(1),
SDiv->getName() + ".udiv", SDiv->getIterator());
UDiv->setIsExact(SDiv->isExact());
SDiv->replaceAllUsesWith(UDiv);
```
```
void SimplifyIndvar::replaceSRemWithURem(BinaryOperator *Rem) {
auto *URem = BinaryOperator::Create(BinaryOperator::URem, N, D,
Rem->getName() + ".urem", Rem->getIterator());
Rem->replaceAllUsesWith(URem);
```
```
void SimplifyIndvar::replaceRemWithNumeratorOrZero(BinaryOperator *Rem) {
SelectInst *Sel =
SelectInst::Create(ICmp, ConstantInt::get(T, 0), N, "iv.rem", Rem->getIterator());
Rem->replaceAllUsesWith(Sel);
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJysVE2PqzYU_TVmY00EF0hgwWISXqQsOk9KXlqpOwM34MrY1Da8zr-vbJhmJmLaLiZCRPiecz_OhcOM4a1ELEi6J2kZsNF2ShdmMk9_jrwOKtW8Fj861EiZRmo7jUi5NJbJGg396SO2Q9pgNbaUy5vSPbNcSdoxQ6WytEKUdNBqYC2z2FCrPEHiT9rwicBRY-9T6rF2REPiZxKWJPx434bL5R8rpQS98H4Q_PZ6ks3EtKPFzyh4zyWzeCld8mzPJdOv3wfUzCpNCTzPgZyS3X7OxUarXOBa8omSuKQfOXPeg0ZmkUA2c-jyW4NefYEDdYWeSPytResBsiGQhQTyT4PRHPxY4h3yhfW-Bdc97CkB2IxeQ3hIebJLQx7srngZ9rqADNqT-fYXqy2B7I3J_zl5YL0BNA6C1fgsxNWg-Y3bjkA2z3sHP6xq9XBSvFnd31Lhcsbepb-esV_doj9fW-IZ-_9e4urafMoDfXG38r6GM_b_Ir92JC__Hfe5-gtmXcZ5pC-VcVHxZeznjr7r31Gr_yXoBQXW9iSN9R8NCqfq-zfzDngQ93ToByfIQXmfsCe5IFp0r9YPF3v7DLzYBIBPm69T8oJiVcigKeImj3MWYBHtojyLIU8g6Ipw2yTJNo7zLM3TXZ1s6ypK6zCCqL7lDcYBLyCEJNyFURQBAGwgS7OaJbDLtlW4g5QkIfaMi40QU79Rug24MSMW-Q4yCASrUBjvsQDO-HzQTZuWgS4c56kaW0OSUHBjzT2L5VZ4cy6dv57kTZG0JOn-3c5_ZZqkJf2FG8NluxixUPXswuPQMIuG3pT-xG6DUYuis3bwxgtHAseW226sNrXqCRxdL8vf06DVH-gM4ugnMASO84RTAX8HAAD__yn85Dk">