[Mlir-commits] [flang] [mlir] [openmp] [MLIR][OpenMP] Add scan reduction lowering to llvm (PR #167031)

Kareem Ergawy llvmlistbot at llvm.org
Thu Nov 27 03:30:51 PST 2025


================
@@ -2574,20 +2667,76 @@ convertOmpWsloop(Operation &opInst, llvm::IRBuilderBase &builder,
   if (failed(handleError(regionBlock, opInst)))
     return failure();
 
-  llvm::CanonicalLoopInfo *loopInfo = findCurrentLoopInfo(moduleTranslation);
+  SmallVector<llvm::CanonicalLoopInfo *> loopInfos =
+      findCurrentLoopInfos(moduleTranslation);
+
+  const auto &&wsloopCodeGen = [&](llvm::CanonicalLoopInfo *loopInfo,
+                                   bool noLoopMode, bool inputScanLoop) {
+    // Emit Initialization and Update IR for linear variables
+    if (!isInScanRegion && !wsloopOp.getLinearVars().empty()) {
----------------
ergawy wrote:

Since we have an assertion below, can we just check of linear vars:
```suggestion
    if (!wsloopOp.getLinearVars().empty()) {
```

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


More information about the Mlir-commits mailing list