[all-commits] [llvm/llvm-project] ff218c: [InstSimplify] Fold degenerate abs of abs form

Nikita Popov via All-commits all-commits at lists.llvm.org
Sun Sep 6 00:45:14 PDT 2020


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

  Changed paths:
    M llvm/lib/Analysis/InstructionSimplify.cpp
    M llvm/test/Transforms/InstSimplify/abs_intrinsic.ll

  Log Message:
  -----------
  [InstSimplify] Fold degenerate abs of abs form

This addresses the remaining issue from D87188. Due to a series of
folds, we may end up with abs-of-abs represented as
x == 0 ? -abs(x) : abs(x). Rather than recognizing this as a special
abs pattern and doing an abs-of-abs fold on it afterwards,
I'm directly folding this to one of the select operands in InstSimplify.

The general pattern falls into the "select with operand replaced"
category, but that fold is not powerful enough to recognize that
both hands of the select are the same for value zero.

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




More information about the All-commits mailing list