================
@@ -329,3 +329,27 @@ bool
WebAssemblyRegColoring::runOnMachineFunction(MachineFunction &MF) {
}
return true;
}
+
+bool WebAssemblyRegColoringLegacy::runOnMachineFunction(MachineFunction &MF) {
+ LiveIntervals *Liveness = &getAnalysis<LiveIntervalsWrapperPass>().getLIS();
+ const MachineBlockFrequencyInfo *MBFI =
+ &getAnalysis<MachineBlockFrequencyInfoWrapperPass>().getMBFI();
+ return regColoring(MF, Liveness, MBFI);
+}
+
+PreservedAnalyses
+WebAssemblyRegColoringPass::run(MachineFunction &MF,
+ MachineFunctionAnalysisManager &MFAM) {
+ // TODO(boomanaiden154): We duplicate this check from above to avoid
computing
+ // analyses if we do not need to. We should remove it when remove support for
+ // the LegacyPM and are able to simplify things.
+ if (MF.exposesReturnsTwice())
+ return PreservedAnalyses::all();
----------------
aheejin wrote:
I don't understand. We check this in `regColoring` anyway. Why does checking
this in the legacy pass entry point instead cost you more compile time?
So the entry point for the legacy pass is
`WebAssemblyRegColoringLegacy::runOnMachineFunction`, and the entry for the new
pass is `WebAssemblyRegColoringPass::run`. Both call `regColoring`. This PR
currently checks `MF.exposesReturnsTwice` in `WebAssemblyRegColoringPass::run`
and `regColoring`. What I suggest is to move the check in `regColoring` to
`WebAssemblyRegColoringLegacy::runOnMachineFunction`. This way both the old and
the new PM check it in the same way in their entry point functions.
https://github.com/llvm/llvm-project/pull/210225
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits