File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -143,6 +143,12 @@ class SymbolLinkerInterface : public LinkerInterface<SymbolLinkerInterface> {
143143 return state.clone (src);
144144 }
145145
146+ // / Perform tasks that need to be computed on whole-module basis before actual summary.
147+ // / E.g. Pre-compute COMDAT resolution before actually linking the modules.
148+ virtual LogicalResult moduleOpSummary (ModuleOp module ) {
149+ return success ();
150+ }
151+
146152 // / Dependencies of the given operation required to be linked.
147153 virtual SmallVector<Operation *>
148154 dependencies (Operation *op, SymbolTableCollection &collection) const = 0 ;
@@ -276,6 +282,14 @@ class SymbolLinkerInterfaces {
276282 return Conflict::noConflict (src);
277283 }
278284
285+ LogicalResult moduleOpSummary (ModuleOp src) {
286+ for (SymbolLinkerInterface *linker : interfaces) {
287+ if (failed (linker->moduleOpSummary (src)))
288+ return failure ();
289+ }
290+ return success ();
291+ }
292+
279293private:
280294 SetVector<SymbolLinkerInterface *> interfaces;
281295};
Original file line number Diff line number Diff line change @@ -36,8 +36,11 @@ class BuiltinLinkerInterface : public ModuleLinkerInterface {
3636
3737 LogicalResult summarize (ModuleOp src, unsigned flags) override {
3838 WalkResult result = src.walk ([&](Operation *op) {
39- if (op == src)
39+ if (op == src) {
40+ if (symbolLinkers.moduleOpSummary (src).failed ())
41+ return WalkResult::interrupt ();
4042 return WalkResult::advance ();
43+ }
4144
4245 if (summarize (op, flags, /* forDependency=*/ false ).failed ())
4346 return WalkResult::interrupt ();
You can’t perform that action at this time.
0 commit comments