[llvm] [InstCombine] Fold abs(a * abs(b)) --> abs(a * b) (PR #78110)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 6 01:10:34 PST 2024


================
@@ -218,6 +218,16 @@ Instruction *InstCombinerImpl::visitMul(BinaryOperator &I) {
                   : BinaryOperator::CreateNeg(Op0);
   }
 
+  {
+    // abs(a * abs(b)) --> abs(a * b)
----------------
nikic wrote:

Yes, it should. Pretty sure the original patch did do it that way, why was it moved here? Now it's folding `a * abs(b)` to `a * b`, which isn't right.

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


More information about the llvm-commits mailing list