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

    <tr>
        <th>Summary</th>
        <td>
            How to find ForOp arg's preOp in MLIR
        </td>
    </tr>

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

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

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

<pre>
    `%39 = tt.addptr %38, %37 : tensor<32x64x!tt.ptr<f16>>, tensor<32x64xi32>
    %40 = tt.expand_dims %30 {axis = 1 : i32} : (tensor<64xi32>) -> tensor<64x1xi32>
    %41 = tt.splat %arg7 : (i32) -> tensor<64x1xi32>
    %42 = arith.muli %40, %41 : tensor<64x1xi32>
    %43 = tt.expand_dims %26 {axis = 0 : i32} : (tensor<32xi32>) -> tensor<1x32xi32>
    %44 = tt.broadcast %42 : (tensor<64x1xi32>) -> tensor<64x32xi32>
    %45 = tt.broadcast %43 : (tensor<1x32xi32>) -> tensor<64x32xi32>
    %46 = arith.addi %44, %45 : tensor<64x32xi32>
    %47 = tt.splat %arg1 : (!tt.ptr<f16>) -> tensor<64x32x!tt.ptr<f16>>
    %48 = tt.addptr %47, %46 : tensor<64x32x!tt.ptr<f16>>, tensor<64x32xi32>
    %49 = arith.addi %arg5, %c63_i32 : i32
    %50 = arith.divsi %49, %c64_i32 : i32
    %51 = arith.muli %arg6, %c64_i32 : i32
    %52 = tt.splat %51 : (i32) -> tensor<32x64xi32>
    %53 = arith.muli %arg7, %c64_i32 : i32
    %54 = tt.splat %53 : (i32) -> tensor<64x32xi32>
    %55:3 = scf.for %arg9 = %c0_i32 to %50 step %c1_i32 iter_args(%arg10 = %cst, %arg11 = %39, %arg12 = %48) -> (tensor<32x32xf32>, tensor<32x64x!tt.ptr<f16>>, tensor<64x32x!tt.ptr<f16>>)  : i32 {
      %73 = tt.load %arg11 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<32x64xf16>
      %74 = tt.load %arg12 {cache = 1 : i32, evict = 1 : i32, isVolatile = false} : tensor<64x32xf16>
      %75 = tt.dot %73, %74, %arg10 {allowTF32 = true} : tensor<32x64xf16> * tensor<64x32xf16> -> tensor<32x32xf32>
      %76 = tt.addptr %arg11, %52 : tensor<32x64x!tt.ptr<f16>>, tensor<32x64xi32>
 %77 = tt.addptr %arg12, %54 : tensor<64x32x!tt.ptr<f16>>, tensor<64x32xi32>
      scf.yield %75, %76, %77 : tensor<32x32xf32>, tensor<32x64x!tt.ptr<f16>>, tensor<64x32x!tt.ptr<f16>>
    }`

i want find %arg11 PreOp(%39 = tt.addptr) in ForOp

i try to use %arg11.getDefiningOp(),but this func return NULL

try to use getBackwardSlice(%arg11), this func return ForOp's all arg PreOp

how to get %arg11 PreOp, can anyone help me
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0Vl1vqzgQ_TXmxWqEx3yEBx7a5ka7Unfvar9eKwOGeNcBZJs2-fcrG0hIgN6udK9UtcmAz5w5M3NqprWoas5TFD6hcOexzhwalcrmjctzxlntZU1xTlHkIwhpghHdYWM2rChao7CNbRE8uw8xRvQRG17rRiH6TOEUBScExJhNa2ykJBGiX-wPPN-_JyjYB_4O-Y8YYwsY-GM2fmpZXbwW4qhdJh-j-ImdhHYvEJfXAsQ79xHB9oJ-hYYEPyD6BU8fkcW8ZMyrW8mMDTFVxSO0PfF5LHBYTAlz2Bw7KfrCBskCcivZKgpdUQKiGyX8j5SgsKoEOV0f3uQNxryZaliRM20uRc1kJh8JvYIfLuPTGf6U4f_Ajybqs6Lo1Q9G9cOZ-isw8dJAkJHkwoivUFxehptU2_mGBfFIOFoi_O0NWy8sWdCHqSocEuYRfRUULlM1PRv6k7OFeNO9uMnlaLB-lCwsBVNV9JmzMOtFSD5czVV_CekyjfgzNII5Dfoth1huQhgi-thT0Xm5KRs18OibY4n4jodpBt214a2LExcXhq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