[flang-commits] [flang] [llvm] [flang] Support static-unit array slices in FIR LoopVersioning (PR #222723)
Sergey Shcherbinin via flang-commits
flang-commits at lists.llvm.org
Thu Sep 24 03:18:33 PDT 2026
================
@@ -285,6 +920,458 @@ static mlir::Value getIndex(fir::FirOpBuilder &builder, mlir::Operation *op,
return mlir::arith::SubIOp::create(builder, coop.getLoc(), index, lb);
}
+/// Convert one cloned slice operand to the index type before arithmetic.
+/// Preflight proved that this conversion preserves the effective index-domain
+/// bit pattern used by generic lowering.
+static mlir::Value materializeIndex(fir::FirOpBuilder &builder,
+ mlir::Location loc, mlir::Value value) {
+ mlir::Type indexType = builder.getIndexType();
+ if (value.getType() == indexType)
+ return value;
+ return builder.createConvert(loc, indexType, value);
+}
----------------
SergeyShch01 wrote:
The `materializeIndex` helper has been removed, and the rewritten code calls `createConvert` directly where no special integer-cast semantics are required.
https://github.com/llvm/llvm-project/pull/222723
More information about the flang-commits
mailing list