[llvm] [CodeGenPrepare] Folding `urem` with loop invariant value as remainder (PR #96625)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 25 08:16:54 PDT 2024


================
@@ -8360,6 +8520,11 @@ bool CodeGenPrepare::optimizeInst(Instruction *I, ModifyDT &ModifiedDT) {
     if (optimizeCmp(Cmp, ModifiedDT))
       return true;
 
+  if (match(I, m_URem(m_Value(), m_Value())) ||
+      match(I, m_SRem(m_Value(), m_Value())))
----------------
nikic wrote:

```suggestion
  if (match(I, m_IRem(m_Value(), m_Value())))
```

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


More information about the llvm-commits mailing list