[llvm] [InstCombine] simplify `(X * C0) / (X * C1)` into `C0 / C1`. (PR #73204)
    Yingwei Zheng via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Sun Nov 26 18:42:18 PST 2023
    
    
  
================
@@ -1207,6 +1207,18 @@ Instruction *InstCombinerImpl::commonIDivTransforms(BinaryOperator &I) {
     }
   }
 
+  // (X * C0) / (X * C1) --> C0 / C1
+  Constant *C0, *C1;
+  if (match(Op0, m_c_Mul(m_Value(X), m_Constant(C0))) &&
----------------
dtcxzyw wrote:
> What do I need to do
You should check `c1 != -1 || c1 != sign mask`.
https://github.com/llvm/llvm-project/pull/73204
    
    
More information about the llvm-commits
mailing list