[flang-commits] [flang] [flang][codegen] Rebuild compile-time-only block arguments in cg-rewrite (PR #227624)

via flang-commits flang-commits at lists.llvm.org
Wed Sep 30 05:26:43 PDT 2026


================
@@ -434,13 +435,128 @@ static void simpleDCE(mlir::RewriterBase &rewriter, mlir::Operation *op) {
       });
 }
 
+/// A fir.shape, fir.shape_shift, fir.shift or fir.slice only describes an
+/// array at compile time. The rewrites above read it through its defining op
+/// and fold it into the code-gen form, so such a value never reaches codegen
+/// and none of these types has an LLVM lowering.
+static bool isCompileTimeOnly(mlir::Type type) {
----------------
jeanPerier wrote:

fir.shape has a codegen and you can extract the runtime values from it via a fir.shape_extents operation.
Can you use that for this one as I think this should be the long term solution?

https://github.com/llvm/llvm-project/pull/227624


More information about the flang-commits mailing list