[PATCH] D137858: ConstantFolding: Constant fold some canonicalizes

Matt Arsenault via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 11 11:38:25 PST 2022


arsenm created this revision.
arsenm added reviewers: scanon, escha, spatel, kpn, andrew.w.kaylor.
Herald added a subscriber: hiraditya.
Herald added a project: All.
arsenm requested review of this revision.
Herald added a subscriber: wdng.
Herald added a project: LLVM.

+/-0 is obviously foldable. Other non-special, non-subnormal
values are also probably OK. For denormal values, check
the calling function's denormal mode. For now, don't fold
denormals to the input for IEEE mode because as far as I know
the langref is still pretending LLVM's float isn't IEEE.

      

Also folds undef to 0, although NaN may make more sense. Skips
folding nans and infinities, although it should be OK to fold those
in a future change.


https://reviews.llvm.org/D137858

Files:
  llvm/lib/Analysis/ConstantFolding.cpp
  llvm/test/Transforms/InstSimplify/canonicalize.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137858.474820.patch
Type: text/x-patch
Size: 13585 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20221111/eeb6fdec/attachment.bin>


More information about the llvm-commits mailing list