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

David Sherwood via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 1 05:39:47 PDT 2022


david-arm created this revision.
david-arm added reviewers: sdesmalen, kmclaughlin, CarolineConcatto, MattDevereau, spatel, nikic.
Herald added a subscriber: hiraditya.
Herald added a project: All.
david-arm requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126774

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126774.433363.patch
Type: text/x-patch
Size: 7416 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220601/759d3c18/attachment.bin>


More information about the llvm-commits mailing list