[llvm] [CodeGen] Emit a more efficient magic number multiplication for exact udivs (PR #87161)
    Matt Arsenault via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Fri May  3 12:20:18 PDT 2024
    
    
  
================
@@ -5122,6 +5149,29 @@ MachineInstr *CombinerHelper::buildUDivUsingMul(MachineInstr &MI) {
     return true;
   };
 
+  if (MI.getFlag(MachineInstr::MIFlag::IsExact)) {
+    // Collect all magic values from the build vector.
+    bool Matched = matchUnaryPredicate(MRI, RHS, BuildExactUDIVPattern);
+    (void)Matched;
+    assert(Matched && "Expected unary predicate match to succeed");
----------------
arsenm wrote:
I think it's a bit cleaner to write this type of assert as if (!match...) llvm_unreachable 
https://github.com/llvm/llvm-project/pull/87161
    
    
More information about the llvm-commits
mailing list