[llvm] [AMDGPU][NewPM] Port SIShrinkInstructions to new pass manager. (PR #106967)

Christudasan Devadasan via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 2 10:24:32 PDT 2024


================
@@ -1077,3 +1081,21 @@ bool SIShrinkInstructions::runOnMachineFunction(MachineFunction &MF) {
   }
   return false;
 }
+
+bool SIShrinkInstructionsLegacy::runOnMachineFunction(MachineFunction &MF) {
+  if (skipFunction(MF.getFunction()))
+    return false;
+
+  return SIShrinkInstructions().run(MF);
+}
+
+PreservedAnalyses
+SIShrinkInstructionsPass::run(MachineFunction &MF,
+                              MachineFunctionAnalysisManager &) {
+  if (MF.getFunction().hasOptNone() || !SIShrinkInstructions().run(MF))
----------------
cdevadas wrote:

This early exit is mainly to skip the optimization passes for -O0. This specific check hasOptNone checks for the function attribute Attribute::OptimizeNone, set to true for -O0 opt.levels. The attributes and metadata are still in the LLVM IR and not available in the MIR. 

https://github.com/llvm/llvm-project/pull/106967


More information about the llvm-commits mailing list