[llvm] [CodeGen] [EarlyIfConversion] Prioritize conversion of hard to predict branches (PR #174457)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 26 03:58:04 PST 2026


================
@@ -896,6 +915,101 @@ void EarlyIfConverter::invalidateTraces() {
   Traces->verifyAnalysis();
 }
 
+static bool isConstantPoolLoad(const MachineInstr *MI) {
+  // Check if this instruction is a load.
+  if (MI->mayLoad()) {
+    for (const auto &MOp : MI->memoperands()) {
+      if (const PseudoSourceValue *PSV = MOp->getPseudoValue())
+        if (PSV->isConstantPool())
+          return true;
+    }
+  }
----------------
fhahn wrote:

can use any_of to make a bit more compact
```suggestion
   return any_of(MI->memoperands(), [](MOp) {
     const PseudoSourceValue *PSV = MOp->getPseudoValue();
      return PSV && PSV->isConstantPool();
    }
  }
```

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


More information about the llvm-commits mailing list