[all-commits] [llvm/llvm-project] 7a71ac: [InstCombine] Canonicalize fcmp with inf (#80986)

Yingwei Zheng via All-commits all-commits at lists.llvm.org
Wed Feb 7 07:27:53 PST 2024


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

  Changed paths:
    M llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
    M llvm/test/Transforms/InstCombine/and-fcmp.ll
    A llvm/test/Transforms/InstCombine/canonicalize-fcmp-inf.ll
    M llvm/test/Transforms/InstCombine/create-class-from-logic-fcmp.ll
    M llvm/test/Transforms/InstCombine/fold-select-fmul-if-zero.ll

  Log Message:
  -----------
  [InstCombine] Canonicalize fcmp with inf (#80986)

This patch canonicalizes floating-point comparisons with inf:
```
fcmp olt X, +inf -> fcmp one X, +inf
fcmp ole X, +inf -> fcmp ord X, 0
fcmp ogt X, +inf -> false
fcmp oge X, +inf -> fcmp oeq X, +inf
fcmp ult X, +inf -> fcmp une X, +inf
fcmp ule X, +inf -> true
fcmp ugt X, +inf -> fcmp uno X, 0
fcmp uge X, +inf -> fcmp ueq X, +inf
fcmp olt X, -inf -> false
fcmp ole X, -inf -> fcmp oeq X, -inf
fcmp ogt X, -inf -> fcmp one X, -inf
fcmp oge X, -inf -> fcmp ord X, 0
fcmp ult X, -inf -> fcmp uno X, 0
fcmp ule X, -inf -> fcmp ueq X, -inf
fcmp ugt X, -inf -> fcmp une X, -inf
fcmp uge X, -inf -> true
```
Alive2: https://alive2.llvm.org/ce/z/FRqqDg

The motivation of this patch is to fix the regression found in
https://github.com/dtcxzyw/llvm-opt-benchmark/pull/199#discussion_r1480974120.




More information about the All-commits mailing list