[llvm] [SimplifyCFG] Treat umul + extract pattern as cheap single instruction. (PR #124933)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 2 08:33:52 PST 2025


================
@@ -3324,26 +3338,36 @@ bool SimplifyCFGOpt::speculativelyExecuteBB(BranchInst *BI,
                                     HoistLoadsStoresWithCondFaultingThreshold;
     // Not count load/store into cost if target supports conditional faulting
     // b/c it's cheap to speculate it.
+    WithOverflowInst *OI;
     if (IsSafeCheapLoadStore)
       SpeculatedConditionalLoadsStores.push_back(&I);
+    else if (match(&I,
+              m_ExtractValue<1>(m_OneUse(
+                  m_WithOverflowInst(OI))))) {
+      MaxSpeculatedInstructionsToHoist = 3;
----------------
nikic wrote:

Also, why don't we increment SpeculatedInstructions in this branch? I think in the end you'll allow 2 more instructions than you actually want. Can you please add a test that shows that you don't actually allow more than just the pattern?

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


More information about the llvm-commits mailing list