[PATCH] D87196: [InstCombine] Fold abs of known negative operand

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 5 08:37:09 PDT 2020


nikic created this revision.
nikic added reviewers: spatel, lebedev.ri.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
nikic requested review of this revision.

If we know that the abs operand is known negative, we can replace it with a neg.

To avoid computing known bits twice, I've removed the fold for the non-negative case from InstSimplify. Both the non-negative and the negative case are handled by InstCombine now, with one known bits call.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D87196

Files:
  llvm/lib/Analysis/InstructionSimplify.cpp
  llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
  llvm/test/Transforms/InstCombine/abs-intrinsic.ll
  llvm/test/Transforms/InstSimplify/abs_intrinsic.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87196.290097.patch
Type: text/x-patch
Size: 5621 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200905/fb0d21a9/attachment.bin>


More information about the llvm-commits mailing list