[all-commits] [llvm/llvm-project] e97f3b: [InstCombine] Fold abs of known negative operand

Nikita Popov via All-commits all-commits at lists.llvm.org
Tue Sep 8 11:17:57 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: e97f3b1b4327f9db0ca12cdd7157c304ad206802
      https://github.com/llvm/llvm-project/commit/e97f3b1b4327f9db0ca12cdd7157c304ad206802
  Author: Nikita Popov <nikita.ppv at gmail.com>
  Date:   2020-09-08 (Tue, 08 Sep 2020)

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

  Log Message:
  -----------
  [InstCombine] Fold abs of known negative operand

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.

Differential Revision: https://reviews.llvm.org/D87196




More information about the All-commits mailing list