[PATCH] D122013: [InstCombine] Fold abs of known negative operand when source is sub

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 18 18:53:23 PDT 2022


craig.topper added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/abs-intrinsic.ll:445
+cond.true:
+  %sub = sub nsw i32 %x, %y
+  %0 = call i32 @llvm.abs.i32(i32 %sub, i1 true)
----------------
I think the nsw flag is required to make this transform valid, but code doesn't check for it.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D122013/new/

https://reviews.llvm.org/D122013



More information about the llvm-commits mailing list