[llvm] [OpenMP] [IR Builder] Changes to Support Scan Operation (PR #136035)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 13 14:45:04 PDT 2025
================
@@ -508,6 +508,30 @@ class OpenMPIRBuilder {
return allocaInst;
}
};
+
+ struct ScanInformation {
+ /// Dominates the body of the loop before scan directive
+ llvm::BasicBlock *OMPBeforeScanBlock = nullptr;
+ /// Dominates the body of the loop before scan directive
+ llvm::BasicBlock *OMPAfterScanBlock = nullptr;
+ /// Controls the flow to before or after scan blocks
+ llvm::BasicBlock *OMPScanDispatch = nullptr;
+ /// Exit block of loop body
+ llvm::BasicBlock *OMPScanLoopExit = nullptr;
+ /// Block before loop body where scan initializations are done
+ llvm::BasicBlock *OMPScanInit = nullptr;
+ /// Block after loop body where scan finalizations are done
+ llvm::BasicBlock *OMPScanFinish = nullptr;
+ /// If true, it indicates Input phase is lowered; else it indicates
+ /// ScanPhase is lowered
+ bool OMPFirstScanLoop = false;
+ // Maps the private reduction variable to the pointer of the temporary
+ // buffer
+ llvm::SmallDenseMap<llvm::Value *, llvm::Value *> ScanBuffPtrs;
+ llvm::Value *IV;
+ llvm::Value *Span;
+ } ScanInfo;
----------------
Meinersbur wrote:
```suggestion
};
```
Usually it is not a good idea remember such data between methods calls. Better pass a handle object between methods calls, such as `AtomicInfo` and `CanonicalLoopInfo`.
The type would consistently be called `ScanInfo`.
https://github.com/llvm/llvm-project/pull/136035
More information about the llvm-commits
mailing list