llvm/llvm-project

Missing FP optimization opportunities for fcmp ord operations

クローズ

#49,175 opened on 2021/04/04

 (4 件のコメント) (1 件のリアクション) (1 人の担当者)C++ (10,782 件のフォーク)batch import
bugzillafloating-pointgood first issuellvm:optimizationsmissed-optimization

Repository metrics

Stars
 (26,378 個のスター)
PR merge metrics
 (平均マージ 1d 2h) (30d で 1,000 merged PRs)

説明

Bugzilla Link 49831
Version trunk
OS All
Blocks llvm/llvm-project#49274
CC @RKSimon,@rotateright

Extended Description

; Excerpted from llvm/test/Transforms/InstCombine/and-fcmp.ll

define i1 @_commute_logical(i1 %z, float %c, float %d) {
  %ord1 = fcmp ninf ord float %c, 0.0
  %and = select i1 %ord1, i1 %z, i1 false
  %ord2 = fcmp ninf reassoc ord float %d, 0.0
  %r = select i1 %ord2, i1 %and, i1 false
  ret i1 %r
}

This can be optimized to

  %c.fr = freeze float %c
  %ord1 = fcmp ord float %c.fr, %d
  %r = select i1 %ord1, i1 %z, i1 false

Alive2 link: https://alive2.llvm.org/ce/z/QfkJak

コントリビューターガイド