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

Gábor Spaits via llvm-commits llvm-commits at lists.llvm.org
Sun Feb 2 08:39:37 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;
----------------
spaits wrote:

It was 3 instead of 2 because I have counted in the terminator instruction, but looking again at the loop, it is being dropped, so you are right there is no need for that.

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


More information about the llvm-commits mailing list