[PATCH] D89063: [GlobalISel] Add missing pass dependencies for IRTranslator

Quentin Colombet via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 8 12:12:37 PDT 2020


qcolombet created this revision.
qcolombet added reviewers: aemerson, arsenm, paquette, volkan, aditya_nandakumar, dsanders.
Herald added subscribers: hiraditya, rovka.
Herald added a project: LLVM.
qcolombet requested review of this revision.
Herald added a subscriber: wdng.

The IRTranslator depends on the branch probability info pass when the optimization level is different than None and it depends all the time on the StackProtector pass.

We have to explicitly call out pass dependencies otherwise the pass manager may not be able to schedule the IRTranslator.

Right now we are lucky because previous passes depend on the branch probability info pass (like the Global Variable Optimization) and the stack protector pass is initialized in `initializeCodeGen`.
However, if the target has a custom pipeline without any passes like Global Variable Optimization, the pipeline creation will fail, at least because of the branch probability info pass dependency (it is unlikely that initializeCodeGen is not called).

Note: We can alternatively fix this problem by calling initializeBranchProbabilityInfoWrapperPassPass inside the constructor of IRTranslator if we don't like the static dependency from the INITIALIZE_PASS_DEPENDENCY macro.
Note2: We have in theory the same problem for all the dependencies added by getSelectionDAGFallbackAnalysisUsage. Right now this is not a problem because that function does not actually pull any dependendency.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D89063

Files:
  llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp


Index: llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
===================================================================
--- llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -95,6 +95,8 @@
                 false, false)
 INITIALIZE_PASS_DEPENDENCY(TargetPassConfig)
 INITIALIZE_PASS_DEPENDENCY(GISelCSEAnalysisWrapperPass)
+INITIALIZE_PASS_DEPENDENCY(BlockFrequencyInfoWrapperPass)
+INITIALIZE_PASS_DEPENDENCY(StackProtector)
 INITIALIZE_PASS_END(IRTranslator, DEBUG_TYPE, "IRTranslator LLVM IR -> MI",
                 false, false)
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89063.297033.patch
Type: text/x-patch
Size: 583 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201008/45e4bac3/attachment.bin>


More information about the llvm-commits mailing list