[llvm] 5f6b4ce - [InstCombine] Remove nnan requirement for transformation to fabs from select
via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 9 10:29:15 PDT 2021
Author: Krishna
Date: 2021-08-09T22:58:51+05:30
New Revision: 5f6b4ce7de65daec4edce1048f642547ee6fa8c5
URL: https://github.com/llvm/llvm-project/commit/5f6b4ce7de65daec4edce1048f642547ee6fa8c5
DIFF: https://github.com/llvm/llvm-project/commit/5f6b4ce7de65daec4edce1048f642547ee6fa8c5.diff
LOG: [InstCombine] Remove nnan requirement for transformation to fabs from select
In this patch, the "nnan" requirement is removed for the canonicalization of select with fcmp to fabs.
(i) FSub logic: Remove check for nnan flag presence in fsub. Example: https://alive2.llvm.org/ce/z/751svg (fsub).
(ii) FNeg logic: Remove check for the presence of nnan and nsz flag in fneg. Example: https://alive2.llvm.org/ce/z/a_fsdp (fneg).
Reviewed By: spatel
Differential Revision: https://reviews.llvm.org/D106872
Added:
Modified:
llvm/test/Transforms/InstCombine/fabs.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/fabs.ll b/llvm/test/Transforms/InstCombine/fabs.ll
index 2d6834ea502e..a26cc046673d 100644
--- a/llvm/test/Transforms/InstCombine/fabs.ll
+++ b/llvm/test/Transforms/InstCombine/fabs.ll
@@ -249,8 +249,7 @@ define double @multi_use_fabs_fpext(float %x) {
ret double %fabs
}
-; Negative test for the fabs folds below: we require nnan, so
-; we won't always clear the sign bit of a NaN value.
+; X <= 0.0 ? (0.0 - X) : X --> fabs(X)
define double @select_fcmp_ole_zero(double %x) {
; CHECK-LABEL: @select_fcmp_ole_zero(
@@ -263,8 +262,6 @@ define double @select_fcmp_ole_zero(double %x) {
ret double %fabs
}
-; X <= 0.0 ? (0.0 - X) : X --> fabs(X)
-
define double @select_fcmp_nnan_ole_zero(double %x) {
; CHECK-LABEL: @select_fcmp_nnan_ole_zero(
; CHECK-NEXT: [[TMP1:%.*]] = call double @llvm.fabs.f64(double [[X:%.*]])
More information about the llvm-commits
mailing list