aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2023-07-22 08:12:23 -0400
committerMatt Arsenault <Matthew.Arsenault@amd.com>2023-07-24 19:49:06 -0400
commita09d9b42f16264980138a7bebd89f49b38c36fbd (patch)
tree0ff6568ae5b7bf2f678f77cec479a8ac862a0fe2 /llvm/lib/Analysis/ConstantFolding.cpp
parent68b7d3fffd7e8ebc40fdcb0acdcf2e88a93ea5c3 (diff)
downloadllvm-a09d9b42f16264980138a7bebd89f49b38c36fbd.zip
llvm-a09d9b42f16264980138a7bebd89f49b38c36fbd.tar.gz
llvm-a09d9b42f16264980138a7bebd89f49b38c36fbd.tar.bz2
ConstantFolding: Constant fold denormal inputs to canonicalize for IEEE
This makes it possible to use canonicalize to perform a dynamic check for whether denormal flushing is enabled, which will fold out when the denormal mode is known. Previously it would only fold if denormal flushing were known enabled. https://reviews.llvm.org/D156107
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r--llvm/lib/Analysis/ConstantFolding.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index fbc6275..38cccb3 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -1973,9 +1973,8 @@ static Constant *constantFoldCanonicalize(const Type *Ty, const CallBase *CI,
DenormalMode DenormMode =
CI->getFunction()->getDenormalMode(Src.getSemantics());
- // TODO: Should allow folding for pure IEEE.
if (DenormMode == DenormalMode::getIEEE())
- return nullptr;
+ return ConstantFP::get(CI->getContext(), Src);
if (DenormMode.Input == DenormalMode::Dynamic)
return nullptr;