ConstantFolding: Constant fold some canonicalizes
authorMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 11 Nov 2022 19:35:14 +0000 (11:35 -0800)
committerMatt Arsenault <Matthew.Arsenault@amd.com>
Fri, 18 Nov 2022 18:35:19 +0000 (10:35 -0800)
commit841a0edd030d4cce2e6b764996d3372773d0089b
tree6cc2918a56d25976ebe5b9cd5f1be5b3aafea3a3
parent184fbfd7123fecc430c1285531d97ce61c608533
ConstantFolding: Constant fold some canonicalizes

+/-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.
llvm/include/llvm/IR/Type.h
llvm/lib/Analysis/ConstantFolding.cpp
llvm/test/CodeGen/AMDGPU/fcanonicalize.f16.ll
llvm/test/CodeGen/AMDGPU/fcanonicalize.ll
llvm/test/Transforms/InstSimplify/canonicalize.ll