aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ConstantFolding.cpp
diff options
context:
space:
mode:
authorSerge Pavlov <sepavloff@gmail.com>2021-12-16 18:05:41 +0700
committerSerge Pavlov <sepavloff@gmail.com>2021-12-22 13:45:49 +0700
commit77b923d0dbe30f99b27ad533ef4322ee176b2046 (patch)
tree5bb7ff116fbc7fe4d6f9286c5fb4b18bbc8b514e /llvm/lib/Analysis/ConstantFolding.cpp
parent9db0e21660b5cdaebd98aea79cccfe40f1a1ee98 (diff)
downloadllvm-77b923d0dbe30f99b27ad533ef4322ee176b2046.zip
llvm-77b923d0dbe30f99b27ad533ef4322ee176b2046.tar.gz
llvm-77b923d0dbe30f99b27ad533ef4322ee176b2046.tar.bz2
[ConstantFolding] Do not remove side effect from constrained functions
According to the discussion in https://reviews.llvm.org/D110322 the code that removes side effect from replaced function call is deleted. Differential Revision: https://reviews.llvm.org/D115870
Diffstat (limited to 'llvm/lib/Analysis/ConstantFolding.cpp')
-rw-r--r--llvm/lib/Analysis/ConstantFolding.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/llvm/lib/Analysis/ConstantFolding.cpp b/llvm/lib/Analysis/ConstantFolding.cpp
index e4920c3..922b38e 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -1778,15 +1778,8 @@ static bool mayFoldConstrained(ConstrainedFPIntrinsic *CI,
// If the operation does not change exception status flags, it is safe
// to fold.
- if (St == APFloat::opStatus::opOK) {
- // When FP exceptions are not ignored, intrinsic call will not be
- // eliminated, because it is considered as having side effect. But we
- // know that its evaluation does not raise exceptions, so side effect
- // is absent. To allow removing the call, mark it as not accessing memory.
- if (EB && *EB != fp::ExceptionBehavior::ebIgnore)
- CI->addFnAttr(Attribute::ReadNone);
+ if (St == APFloat::opStatus::opOK)
return true;
- }
// If evaluation raised FP exception, the result can depend on rounding
// mode. If the latter is unknown, folding is not possible.