[PATCH] D129368: [mlir][OpenMP] Lower simd if clause to LLVM IR

Dominik Adamski via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 05:53:49 PDT 2022


domada added inline comments.


================
Comment at: llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp:2948-2958
+  LLVMContext &Ctx = Builder.getContext();
+  FunctionAnalysisManager FAM;
+  Function *F = Loops.front()->getFunction();
+  FAM.registerPass([]() { return DominatorTreeAnalysis(); });
+  FAM.registerPass([]() { return LoopAnalysis(); });
+  FAM.registerPass([]() { return PassInstrumentationAnalysis(); });
+
----------------
Meinersbur wrote:
> [serious] As far as I understand, the only reason this instantiates a pass manger is to use the `cloneLoopWithPreheader` function. However, it is sufficient to clone all block from CanonicalLoopInfo::getHeader() to CanonicalLoopInfo::getAfter(). Since the ExitBlock is guaranteed to be the only exit out of the loop (at least until I can introduce breaks; D124823 is a step into that direction), all blocks in the loop can be simply enumerated and cloned without cloneLoopWithPreheader.
> 
> This functionality is probably useful for implementing any loop versioning for `if`-clauses and should probably made its own method.
> 
> 
I do not use `cloneLoopWithPreheader `function any more, but I still need pass manager to define Loop blocks. Original `applySimd ` function also uses pass manager for defining loop blocks. Please let me know if you have better idea, how to extract all body blocks.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D129368/new/

https://reviews.llvm.org/D129368



More information about the llvm-commits mailing list