[all-commits] [llvm/llvm-project] 8daaea: [InstCombine] Use +0.0 instead of -0.0 as the FP i...

david-arm via All-commits all-commits at lists.llvm.org
Fri Jun 10 04:42:49 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 8daaea206b5905858bdbdd881be4fe9bdcc54516
      https://github.com/llvm/llvm-project/commit/8daaea206b5905858bdbdd881be4fe9bdcc54516
  Author: David Sherwood <david.sherwood at arm.com>
  Date:   2022-06-10 (Fri, 10 Jun 2022)

  Changed paths:
    M llvm/include/llvm/IR/Constants.h
    M llvm/lib/IR/Constants.cpp
    M llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
    M llvm/test/Transforms/InstCombine/select-binop-foldable-floating-point.ll

  Log Message:
  -----------
  [InstCombine] Use +0.0 instead of -0.0 as the FP identity for some folds

In foldSelectIntoOp we sometimes transform a select of a fadd into a
fadd of a select, where we select between data and an identity value.
For both fadd and fsub the identity is always -0.0, but if the nsz
flag is set on the select instruction we can use +0.0 instead. Doing
so then triggers other optimisations, such as when folding the select
of masked load into a new masked load.

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




More information about the All-commits mailing list