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

via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 13 09:30:37 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:

I don't think so, in that case you aren't saving any instructions and basically just throwing out `exact` and doing `udiv`-> `sdiv`. Both of which alone are not profitable.

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


More information about the llvm-commits mailing list