[all-commits] [llvm/llvm-project] 4858e9: [InstCombine] Canonicalize the fcmp range check id...

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Tue Feb 6 12:33:38 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4858e9c9feb94d65acdb284fc2eaa5fe131c6584
      https://github.com/llvm/llvm-project/commit/4858e9c9feb94d65acdb284fc2eaa5fe131c6584
  Author: Yingwei Zheng <dtcxzyw2333 at gmail.com>
  Date:   2024-02-07 (Wed, 07 Feb 2024)

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
    A llvm/test/Transforms/InstCombine/fcmp-range-check-idiom.ll

  Log Message:
  -----------
  [InstCombine] Canonicalize the fcmp range check idiom into `fabs + fcmp` (#76367)

This patch canonicalizes the fcmp range check idiom into `fabs + fcmp`
since the canonicalized form is better than the original form for the
backends.
Godbolt: https://godbolt.org/z/x3eqPb1fz
```
and (fcmp olt/ole/ult/ule x, C), (fcmp ogt/oge/ugt/uge x, -C) --> fabs(x) olt/ole/ult/ule C
or  (fcmp ogt/oge/ugt/uge x, C), (fcmp olt/ole/ult/ule x, -C) --> fabs(x) ogt/oge/ugt/uge C
```
Alive2: https://alive2.llvm.org/ce/z/MRtoYq




More information about the All-commits mailing list