================
@@ -62,16 +66,12 @@ ModulePass *llvm::createWebAssemblyMCLowerPrePass() {
 //
 // The information stored here is essential for emitExternalDecls in the Wasm
 // AsmPrinter
-bool WebAssemblyMCLowerPrePass::runOnModule(Module &M) {
-  auto *MMIWP = getAnalysisIfAvailable<MachineModuleInfoWrapperPass>();
-  if (!MMIWP)
-    return true;
-
-  MachineModuleInfo &MMI = MMIWP->getMMI();
+static void mcLower(Module &M, MachineModuleInfo &MMI,
+                    llvm::function_ref<MachineFunction *(Function *)> GetMF) {
----------------
aheejin wrote:

Not sure if I understand. `MachineModuleInfo` and `GetMF` are separate 
arguments anyway:
```cpp
static void mcLower(Module &M, MachineModuleInfo &MMI,
                    llvm::function_ref<MachineFunction *(Function *)> GetMF) {
```

I think I understand the rationale in #210246 for using `function_ref` for 
analyses because we may not end up needing to compute the analyses (because 
there is an `if` condition before that) but this doesn't seem to be the case 
here. What difference is there when we just pass a function vs. a function that 
returns a function?

https://github.com/llvm/llvm-project/pull/210440
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to