[PATCH] D111537: [fir] Add fir.convert canonicalization patterns

Valentin Clement via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 11 07:11:01 PDT 2021


clementval marked 2 inline comments as done.
clementval added inline comments.


================
Comment at: flang/include/flang/Optimizer/Transforms/RewritePatterns.td:29
+
+def ConvertConvertOptPattern
+    : Pat<(fir_ConvertOp (fir_ConvertOp $arg)),
----------------
kiranchandramohan wrote:
> Do these patterns check that there are no other users? Or is that not a problem here?
These patterns are not removing the ops completely but rather simplifying some patterns. So the users get updated with the new value as well. 


================
Comment at: flang/test/Fir/convert-fold.fir:34
+  %2 = fir.convert %1 : (i32) -> index
+  // CHECK-NEXT: %{{.*}} = constant : index
+  // CHECK-NEXT: return %{{.*}} : index
----------------
kiranchandramohan wrote:
> constant -> constant 10 ?
Good catch! Thanks. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D111537



More information about the llvm-commits mailing list