[PATCH] D102673: [ConstantFolding] Fold constrained arithmetic intrinsics

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 18 01:39:38 PDT 2021


sepavloff created this revision.
sepavloff added reviewers: kpn, craig.topper, foad, arsenm, bkramer.
Herald added subscribers: hiraditya, nemanjai.
sepavloff requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

Constfold constrained variants of operations fadd, fsub, fmul, fdiv,
frem, fma and fmuladd.

The change also sets up some means to support for removal of unused
constrained intrinsics. They are declared as accessing memory to model
interaction with floating point environment, so they were not removed,
as they have side effect. Now constrained intrinsics that have
"fpexcept.ignore" as exception behavior are removed if they have no uses.
As for intrinsics that have exception behavior other than "fpexcept.ignore",
they can be removed if it is known that they do not raise floating point
exceptions. It happens when doing constant folding, attributes of such
intrinsic are changed so that the intrinsic is not claimed as accessing
memory.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D102673

Files:
  llvm/lib/Analysis/ConstantFolding.cpp
  llvm/lib/Transforms/Utils/Local.cpp
  llvm/test/CodeGen/PowerPC/vector-constrained-fp-intrinsics.ll
  llvm/test/Transforms/InstSimplify/constfold-constrained.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102673.346074.patch
Type: text/x-patch
Size: 40859 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210518/d98adee7/attachment.bin>


More information about the llvm-commits mailing list