<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/60190>60190</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [mlir] FunctionOpInterfaceSignatureConversion losing location information
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          benvanik
      </td>
    </tr>
</table>

<pre>
    I'm using `populateFunctionOpInterfaceTypeConversionPattern` on `func::FuncOp` in order to convert function and block signatures. This does not seem to be preserving location information for function and block arguments, even those that do not change.

Before, where only i64 is getting converted to i32, so ^bb0 shouldn't change while ^bb1 should but both lose their locations:
```mlir
func.func @main(%arg0: tensor<1x5xf32> loc("foo.mlir split at line #1":143:17), ...
^bb1(%28: tensor<i64> loc("foo.mlir split at line #1":66:6), ...
```

After:
```mlir
func.func @main(%arg0: tensor<1x5xf32> loc(unknown), ...
^bb1(%28: tensor<i32> loc(unknown), ...
```

The root cause (or at least the first place locations are dropped) is the FIXME in `ArgConverter::applySignatureConversion`:
```c++
  // FIXME: We should map the new arguments to proper locations.
  SmallVector<Location> newLocs(convertedTypes.size(),
 rewriter.getUnknownLoc());
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VE2PpDYQ_TXmUloENtBw4NAzsy2NNNFG2snH1UABzhgb2aZ7J78-KtO9s8lOpOwhasuNXK6P9_yqpPdqMogtK-9Y-ZDILczWtR2aszTqJens8No-Mn5YYPPKTMCqbLXrpmXA02b6oKz5tD6agG6UPT6_rnhvzRmdV9b8LENAZ1iVgTXkOW6mZ-LIxJF8P61kUQasG9BBsNBH1wDjNTJIM0Cnbf8CVKYMm0OfwvOsPAwWPRgbwCMu5NwhrA49ujPVqW0vYwhlRuuW_Xu07r3Y0k3bgiZ4xu8Bz2ggzNYjhFkGGGzM0s_STJiy7IFlx32_w9E6JJ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