[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


================
@@ -4182,6 +4598,8 @@ Expected<CanonicalLoopInfo *> OpenMPIRBuilder::createCanonicalLoop(
     Builder.restoreIP(CodeGenIP);
     Value *Span = Builder.CreateMul(IV, Step);
     Value *IndVar = Builder.CreateAdd(Span, Start);
+    if (InScan)
+      ScanInfo.IV = IndVar;
----------------
Meinersbur wrote:

This is as bad as using globals to pass information between calls. You can nest multiple inscan-loops. At least you would need to make it a stack like `FinalizationStack` if you need to keep track which outer loop we are currently in, but preferably pass `CanonicalLoopInfo` or `ScanInformation` result to whatever needs the IV.

#130135 was meant to generalize the concept of region nesting, avoiding each having nestable region construct manages its own stack.


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


More information about the llvm-commits mailing list