[llvm] [InstCombine] Fold negation of unsigned div of non-negatives (PR #84951)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 12 10:46:01 PDT 2024


================
@@ -2062,6 +2062,26 @@ static Instruction *foldSubOfMinMax(BinaryOperator &I,
   return nullptr;
 }
 
+/// Fold `sub 0, (udiv nneg X, nneg C)` into `sdiv nneg X, -C`
----------------
goldsteinn wrote:

You can handle some additional cases if we have `exact` flag:
https://alive2.llvm.org/ce/z/mmpBoS

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


More information about the llvm-commits mailing list