[llvm] [CodeGen] Preserve branch weights from PGO profile during instruction selection at -O0 (PR #161620)

Grigory Pastukhov via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 6 11:00:00 PDT 2025


================
@@ -229,6 +229,17 @@ static bool dontUseFastISelFor(const Function &Fn) {
   });
 }
 
+static bool shouldRegisterPGOPasses(const TargetMachine &TM,
+                                    CodeGenOptLevel OptLevel) {
+  bool RegisterPGOPasses = OptLevel != CodeGenOptLevel::None;
+  if (!RegisterPGOPasses && TM.getPGOOption()) {
+    const PGOOptions &Options = *TM.getPGOOption();
+    RegisterPGOPasses = Options.Action != PGOOptions::PGOAction::NoAction ||
+                        Options.CSAction != PGOOptions::CSPGOAction::NoCSAction;
----------------
grigorypas wrote:

Makes sense. Fixed.

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


More information about the llvm-commits mailing list