[llvm] [SimplifyCFG] Treat umul + extract pattern as cheap single instruction. (PR #124933)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Jan 30 18:41:18 PST 2025
================
@@ -3329,20 +3331,29 @@ bool SimplifyCFGOpt::speculativelyExecuteBB(BranchInst *BI,
else
++SpeculatedInstructions;
- if (SpeculatedInstructions > 1)
- return false;
-
// Don't hoist the instruction if it's unsafe or expensive.
if (!IsSafeCheapLoadStore &&
!isSafeToSpeculativelyExecute(&I, BI, Options.AC) &&
!(HoistCondStores && !SpeculatedStoreValue &&
(SpeculatedStoreValue =
isSafeToSpeculateStore(&I, BB, ThenBB, EndBB))))
return false;
- if (!IsSafeCheapLoadStore && !SpeculatedStoreValue &&
- computeSpeculationCost(&I, TTI) >
+
+ if (match(&I,
+ m_ExtractValue<1>(m_OneUse(
+ m_Intrinsic<Intrinsic::umul_with_overflow>(m_Value())))) &&
+ ThenBB->size() <= 3)
----------------
goldsteinn wrote:
The `ThenBB->size()` includes debug info which we shouldn't be counting.
https://github.com/llvm/llvm-project/pull/124933
More information about the llvm-commits
mailing list