[PATCH] D112711: [fir] Add FIR CSE specific pass

Valentin Clement via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 24 12:36:22 PDT 2022


clementval added a comment.
Herald added a project: All.

Coming back to this. Looks like the existing CSE is not able to deal with simple use case without analysis. Given the example below I would expect the pass to remove one of the redundant load but this is not happening with the existing MLIR CSE pass but we have such feature in the FIR CSE pass. Maybe I'm missing something but I guess that without a proper analysis the MLIR CSE pass would not be able to deal with such cases in FIR. Should we go ahead and have our dedicated CSE for specific FIR operations or is there smth I'm missing?

  func @fun(%arg0: !fir.ref<i64>) -> i64 {
      %0 = fir.load %arg0 : !fir.ref<i64>
      %1 = fir.load %arg0 : !fir.ref<i64>
      %2 = arith.addi %0, %1 : i64
      return %2 : i64
  }


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112711/new/

https://reviews.llvm.org/D112711



More information about the llvm-commits mailing list