[llvm] 29e4363 - ValueTracking: Look through fneg in isKnownNeverNaN
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 17 08:35:54 PST 2022
Author: Matt Arsenault
Date: 2022-11-17T08:35:49-08:00
New Revision: 29e4363dda1b4d227ebd4d8e86783b05c4543432
URL: https://github.com/llvm/llvm-project/commit/29e4363dda1b4d227ebd4d8e86783b05c4543432
DIFF: https://github.com/llvm/llvm-project/commit/29e4363dda1b4d227ebd4d8e86783b05c4543432.diff
LOG: ValueTracking: Look through fneg in isKnownNeverNaN
Added:
Modified:
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Transforms/InstSimplify/known-never-nan.ll
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 40e4253fae53..4c73eca580f5 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -3869,6 +3869,7 @@ bool llvm::isKnownNeverNaN(const Value *V, const TargetLibraryInfo *TLI,
return true;
case Instruction::FPTrunc:
case Instruction::FPExt:
+ case Instruction::FNeg:
return isKnownNeverNaN(Inst->getOperand(0), TLI, Depth + 1);
default:
break;
diff --git a/llvm/test/Transforms/InstSimplify/known-never-nan.ll b/llvm/test/Transforms/InstSimplify/known-never-nan.ll
index 8b24b2798e65..d6a2924a0215 100644
--- a/llvm/test/Transforms/InstSimplify/known-never-nan.ll
+++ b/llvm/test/Transforms/InstSimplify/known-never-nan.ll
@@ -291,9 +291,7 @@ define i1 @nnan_binary_fneg() {
define i1 @nnan_unary_fneg() {
; CHECK-LABEL: @nnan_unary_fneg(
; CHECK-NEXT: [[NNAN:%.*]] = call nnan double @func()
-; CHECK-NEXT: [[OP:%.*]] = fneg double [[NNAN]]
-; CHECK-NEXT: [[TMP:%.*]] = fcmp ord double [[OP]], [[OP]]
-; CHECK-NEXT: ret i1 [[TMP]]
+; CHECK-NEXT: ret i1 true
;
%nnan = call nnan double @func()
%op = fneg double %nnan
More information about the llvm-commits
mailing list