[Mlir-commits] [flang] [mlir] [flang][mlir][OpenMP] Allow for flexible typing of linear step variables (PR #182816)
Tom Eccles
llvmlistbot at llvm.org
Mon Feb 23 04:26:01 PST 2026
================
@@ -1331,11 +1328,20 @@ bool ClauseProcessor::processLinear(mlir::omp::LinearClauseOps &result) const {
// If nothing is present, add the default step of 1.
fir::FirOpBuilder &firOpBuilder = converter.getFirOpBuilder();
mlir::Location currentLocation = converter.getCurrentLocation();
- mlir::Value operand = firOpBuilder.createIntegerConstant(
- currentLocation, firOpBuilder.getI32Type(), 1);
- result.linearStepVars.append(objects.size(), operand);
+ if (ty.isInteger()) {
+ mlir::Value operand =
+ firOpBuilder.createIntegerConstant(currentLocation, ty, 1);
+ result.linearStepVars.append(objects.size(), operand);
+ } else {
+ // Default to I32 type
+ mlir::Value operand = firOpBuilder.createIntegerConstant(
+ currentLocation, firOpBuilder.getI32Type(), 1);
+ result.linearStepVars.append(objects.size(), operand);
+ }
----------------
tblah wrote:
ultra-nit
```suggestion
mlir::Type integerTy = ty.isInteger() ? ty : firOpBuilder.getI32Type();
mlir::Value operand =
firOpBuilder.createIntegerConstant(currentLocation, integerTy, 1);
result.linearStepVars.append(objects.size(), operand);
```
https://github.com/llvm/llvm-project/pull/182816
More information about the Mlir-commits
mailing list