[llvm] fe5786d - ValueTracking: Implement computeKnownFPClass for sqrt
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Tue May 16 04:41:50 PDT 2023
Author: Matt Arsenault
Date: 2023-05-16T12:41:43+01:00
New Revision: fe5786d41644ec6c739b6ace49d654a21a07cca0
URL: https://github.com/llvm/llvm-project/commit/fe5786d41644ec6c739b6ace49d654a21a07cca0
DIFF: https://github.com/llvm/llvm-project/commit/fe5786d41644ec6c739b6ace49d654a21a07cca0.diff
LOG: ValueTracking: Implement computeKnownFPClass for sqrt
Could be slightly smarter in cases that are probably uninteresting.
Added:
Modified:
llvm/include/llvm/Analysis/ValueTracking.h
llvm/lib/Analysis/ValueTracking.cpp
llvm/test/Transforms/Attributor/nofpclass-sqrt.ll
llvm/unittests/Analysis/ValueTrackingTest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/ValueTracking.h b/llvm/include/llvm/Analysis/ValueTracking.h
index 9630a7bc24ca6..d50a62a1668ee 100644
--- a/llvm/include/llvm/Analysis/ValueTracking.h
+++ b/llvm/include/llvm/Analysis/ValueTracking.h
@@ -293,6 +293,9 @@ struct KnownFPClass {
/// floating-point mode for the function interprets denormals as zero.
bool isKnownNeverLogicalZero(const Function &F, Type *Ty) const;
+ /// Return true if it's know this can never be interpreted as a negative zero.
+ bool isKnownNeverLogicalNegZero(const Function &F, Type *Ty) const;
+
static constexpr FPClassTest OrderedLessThanZeroMask =
fcNegSubnormal | fcNegNormal | fcNegInf;
static constexpr FPClassTest OrderedGreaterThanZeroMask =
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index fb91b982f8c6c..7c2e98d51075d 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -4293,11 +4293,24 @@ static bool inputDenormalIsIEEE(const Function &F, const Type *Ty) {
return F.getDenormalMode(Ty->getFltSemantics()).Input == DenormalMode::IEEE;
}
+static bool inputDenormalIsIEEEOrPosZero(const Function &F, const Type *Ty) {
+ Ty = Ty->getScalarType();
+ DenormalMode Mode = F.getDenormalMode(Ty->getFltSemantics());
+ return Mode.Input == DenormalMode::IEEE ||
+ Mode.Input == DenormalMode::PositiveZero;
+}
+
bool KnownFPClass::isKnownNeverLogicalZero(const Function &F, Type *Ty) const {
return isKnownNeverZero() &&
(isKnownNeverSubnormal() || inputDenormalIsIEEE(F, Ty));
}
+bool KnownFPClass::isKnownNeverLogicalNegZero(const Function &F,
+ Type *Ty) const {
+ return isKnownNeverNegZero() &&
+ (isKnownNeverNegSubnormal() || inputDenormalIsIEEEOrPosZero(F, Ty));
+}
+
/// Returns a pair of values, which if passed to llvm.is.fpclass, returns the
/// same result as an fcmp with the given operands.
std::pair<Value *, FPClassTest> llvm::fcmpToClassTest(FCmpInst::Predicate Pred,
@@ -4711,6 +4724,39 @@ void computeKnownFPClass(const Value *V, const APInt &DemandedElts,
Known.knownNot(fcNegative);
break;
}
+ case Intrinsic::sqrt: {
+ KnownFPClass KnownSrc;
+ FPClassTest InterestedSrcs = InterestedClasses;
+ if (InterestedClasses & fcNan)
+ InterestedSrcs |= KnownFPClass::OrderedLessThanZeroMask;
+
+ computeKnownFPClass(II->getArgOperand(0), DemandedElts,
+ InterestedSrcs, KnownSrc, Depth + 1, Q, TLI);
+
+ if (KnownSrc.isKnownNeverPosInfinity())
+ Known.knownNot(fcPosInf);
+ if (KnownSrc.isKnownNever(fcSNan))
+ Known.knownNot(fcSNan);
+
+ // Any negative value besides -0 returns a nan.
+ if (KnownSrc.isKnownNeverNaN() &&
+ KnownSrc.cannotBeOrderedLessThanZero())
+ Known.knownNot(fcNan);
+
+ // The only negative value that can be returned is -0 for -0 inputs.
+ Known.knownNot(fcNegInf | fcNegSubnormal | fcNegNormal);
+
+ // If the input denormal mode could be PreserveSign, a negative
+ // subnormal input could produce a negative zero output.
+ if (KnownSrc.isKnownNeverLogicalNegZero(*II->getFunction(),
+ II->getType())) {
+ Known.knownNot(fcNegZero);
+ if (KnownSrc.isKnownNeverNaN())
+ Known.SignBit = false;
+ }
+
+ break;
+ }
case Intrinsic::sin:
case Intrinsic::cos: {
// Return NaN on infinite inputs.
diff --git a/llvm/test/Transforms/Attributor/nofpclass-sqrt.ll b/llvm/test/Transforms/Attributor/nofpclass-sqrt.ll
index d86faa3c4fa5e..7fb65db6683e1 100644
--- a/llvm/test/Transforms/Attributor/nofpclass-sqrt.ll
+++ b/llvm/test/Transforms/Attributor/nofpclass-sqrt.ll
@@ -6,9 +6,9 @@ declare <2 x float> @llvm.sqrt.v2f32(<2 x float>)
declare float @llvm.experimental.constrained.sqrt.f32(float, metadata, metadata)
define float @ret_sqrt(float %arg0) #0 {
-; CHECK-LABEL: define float @ret_sqrt
+; CHECK-LABEL: define nofpclass(ninf nsub nnorm) float @ret_sqrt
; CHECK-SAME: (float [[ARG0:%.*]]) #[[ATTR2:[0-9]+]] {
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10:[0-9]+]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10:[0-9]+]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sqrt.f32(float %arg0)
@@ -16,9 +16,9 @@ define float @ret_sqrt(float %arg0) #0 {
}
define float @ret_sqrt_noinf(float nofpclass(inf) %arg0) #0 {
-; CHECK-LABEL: define float @ret_sqrt_noinf
+; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @ret_sqrt_noinf
; CHECK-SAME: (float nofpclass(inf) [[ARG0:%.*]]) #[[ATTR2]] {
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sqrt.f32(float %arg0)
@@ -26,9 +26,9 @@ define float @ret_sqrt_noinf(float nofpclass(inf) %arg0) #0 {
}
define float @ret_sqrt_nopinf(float nofpclass(pinf) %arg0) #0 {
-; CHECK-LABEL: define float @ret_sqrt_nopinf
+; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @ret_sqrt_nopinf
; CHECK-SAME: (float nofpclass(pinf) [[ARG0:%.*]]) #[[ATTR2]] {
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sqrt.f32(float %arg0)
@@ -36,9 +36,9 @@ define float @ret_sqrt_nopinf(float nofpclass(pinf) %arg0) #0 {
}
define float @ret_sqrt_noninf(float nofpclass(ninf) %arg0) #0 {
-; CHECK-LABEL: define float @ret_sqrt_noninf
+; CHECK-LABEL: define nofpclass(ninf nsub nnorm) float @ret_sqrt_noninf
; CHECK-SAME: (float nofpclass(ninf) [[ARG0:%.*]]) #[[ATTR2]] {
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(ninf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sqrt.f32(float %arg0)
@@ -46,9 +46,9 @@ define float @ret_sqrt_noninf(float nofpclass(ninf) %arg0) #0 {
}
define float @ret_sqrt_nonan(float nofpclass(nan) %arg0) #0 {
-; CHECK-LABEL: define float @ret_sqrt_nonan
+; CHECK-LABEL: define nofpclass(snan ninf nsub nnorm) float @ret_sqrt_nonan
; CHECK-SAME: (float nofpclass(nan) [[ARG0:%.*]]) #[[ATTR2]] {
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(snan ninf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sqrt.f32(float %arg0)
@@ -56,9 +56,9 @@ define float @ret_sqrt_nonan(float nofpclass(nan) %arg0) #0 {
}
define float @ret_sqrt_nonan_noinf(float nofpclass(nan inf) %arg0) #0 {
-; CHECK-LABEL: define float @ret_sqrt_nonan_noinf
+; CHECK-LABEL: define nofpclass(snan inf nsub nnorm) float @ret_sqrt_nonan_noinf
; CHECK-SAME: (float nofpclass(nan inf) [[ARG0:%.*]]) #[[ATTR2]] {
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(snan inf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sqrt.f32(float %arg0)
@@ -66,9 +66,9 @@ define float @ret_sqrt_nonan_noinf(float nofpclass(nan inf) %arg0) #0 {
}
define float @ret_sqrt_nonan_noinf_nozero(float nofpclass(nan inf zero) %arg0) #0 {
-; CHECK-LABEL: define float @ret_sqrt_nonan_noinf_nozero
+; CHECK-LABEL: define nofpclass(snan inf nzero nsub nnorm) float @ret_sqrt_nonan_noinf_nozero
; CHECK-SAME: (float nofpclass(nan inf zero) [[ARG0:%.*]]) #[[ATTR2]] {
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(snan inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sqrt.f32(float %arg0)
@@ -76,9 +76,9 @@ define float @ret_sqrt_nonan_noinf_nozero(float nofpclass(nan inf zero) %arg0) #
}
define float @ret_sqrt_noinf_nozero(float nofpclass(inf zero) %arg0) #0 {
-; CHECK-LABEL: define float @ret_sqrt_noinf_nozero
+; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_noinf_nozero
; CHECK-SAME: (float nofpclass(inf zero) [[ARG0:%.*]]) #[[ATTR2]] {
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sqrt.f32(float %arg0)
@@ -86,9 +86,9 @@ define float @ret_sqrt_noinf_nozero(float nofpclass(inf zero) %arg0) #0 {
}
define float @ret_sqrt_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #0 {
-; CHECK-LABEL: define float @ret_sqrt_noinf_nonegzero
+; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_noinf_nonegzero
; CHECK-SAME: (float nofpclass(inf nzero) [[ARG0:%.*]]) #[[ATTR2]] {
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sqrt.f32(float %arg0)
@@ -96,10 +96,10 @@ define float @ret_sqrt_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #0 {
}
define float @ret_sqrt_positive_source(i32 %arg) #0 {
-; CHECK-LABEL: define float @ret_sqrt_positive_source
+; CHECK-LABEL: define nofpclass(nan inf nzero nsub nnorm) float @ret_sqrt_positive_source
; CHECK-SAME: (i32 [[ARG:%.*]]) #[[ATTR2]] {
; CHECK-NEXT: [[UITOFP:%.*]] = uitofp i32 [[ARG]] to float
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[UITOFP]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(nan inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[UITOFP]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%uitofp = uitofp i32 %arg to float
@@ -109,10 +109,10 @@ define float @ret_sqrt_positive_source(i32 %arg) #0 {
; Could produce a nan because we don't know if the multiply is negative.
define float @ret_sqrt_unknown_sign(float nofpclass(nan) %arg0, float nofpclass(nan) %arg1) #0 {
-; CHECK-LABEL: define float @ret_sqrt_unknown_sign
+; CHECK-LABEL: define nofpclass(snan ninf nsub nnorm) float @ret_sqrt_unknown_sign
; CHECK-SAME: (float nofpclass(nan) [[ARG0:%.*]], float nofpclass(nan) [[ARG1:%.*]]) #[[ATTR2]] {
; CHECK-NEXT: [[UNKNOWN_SIGN_NOT_NAN:%.*]] = fmul nnan float [[ARG0]], [[ARG1]]
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[UNKNOWN_SIGN_NOT_NAN]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(snan ninf nsub nnorm) float @llvm.sqrt.f32(float [[UNKNOWN_SIGN_NOT_NAN]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%unknown.sign.not.nan = fmul nnan float %arg0, %arg1
@@ -121,9 +121,9 @@ define float @ret_sqrt_unknown_sign(float nofpclass(nan) %arg0, float nofpclass(
}
define float @ret_sqrt_daz_noinf_nozero(float nofpclass(inf zero) %arg0) #1 {
-; CHECK-LABEL: define float @ret_sqrt_daz_noinf_nozero
+; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @ret_sqrt_daz_noinf_nozero
; CHECK-SAME: (float nofpclass(inf zero) [[ARG0:%.*]]) #[[ATTR3:[0-9]+]] {
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sqrt.f32(float %arg0)
@@ -131,9 +131,9 @@ define float @ret_sqrt_daz_noinf_nozero(float nofpclass(inf zero) %arg0) #1 {
}
define <2 x float> @ret_sqrt_daz_noinf_nozero_v2f32(<2 x float> nofpclass(inf zero) %arg0) #1 {
-; CHECK-LABEL: define <2 x float> @ret_sqrt_daz_noinf_nozero_v2f32
+; CHECK-LABEL: define nofpclass(inf nsub nnorm) <2 x float> @ret_sqrt_daz_noinf_nozero_v2f32
; CHECK-SAME: (<2 x float> nofpclass(inf zero) [[ARG0:%.*]]) #[[ATTR3]] {
-; CHECK-NEXT: [[CALL:%.*]] = call <2 x float> @llvm.sqrt.v2f32(<2 x float> [[ARG0]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) <2 x float> @llvm.sqrt.v2f32(<2 x float> [[ARG0]]) #[[ATTR10]]
; CHECK-NEXT: ret <2 x float> [[CALL]]
;
%call = call <2 x float> @llvm.sqrt.v2f32(<2 x float> %arg0)
@@ -141,9 +141,9 @@ define <2 x float> @ret_sqrt_daz_noinf_nozero_v2f32(<2 x float> nofpclass(inf ze
}
define float @ret_sqrt_daz_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #1 {
-; CHECK-LABEL: define float @ret_sqrt_daz_noinf_nonegzero
+; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @ret_sqrt_daz_noinf_nonegzero
; CHECK-SAME: (float nofpclass(inf nzero) [[ARG0:%.*]]) #[[ATTR3]] {
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sqrt.f32(float %arg0)
@@ -151,9 +151,9 @@ define float @ret_sqrt_daz_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #1
}
define float @ret_sqrt_dapz_noinf_nozero(float nofpclass(inf zero) %arg0) #2 {
-; CHECK-LABEL: define float @ret_sqrt_dapz_noinf_nozero
+; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_dapz_noinf_nozero
; CHECK-SAME: (float nofpclass(inf zero) [[ARG0:%.*]]) #[[ATTR4:[0-9]+]] {
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sqrt.f32(float %arg0)
@@ -161,9 +161,9 @@ define float @ret_sqrt_dapz_noinf_nozero(float nofpclass(inf zero) %arg0) #2 {
}
define float @ret_sqrt_dapz_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #2 {
-; CHECK-LABEL: define float @ret_sqrt_dapz_noinf_nonegzero
+; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_dapz_noinf_nonegzero
; CHECK-SAME: (float nofpclass(inf nzero) [[ARG0:%.*]]) #[[ATTR4]] {
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sqrt.f32(float %arg0)
@@ -171,9 +171,9 @@ define float @ret_sqrt_dapz_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #2
}
define float @ret_sqrt_dynamic_noinf_nozero(float nofpclass(inf zero) %arg0) #3 {
-; CHECK-LABEL: define float @ret_sqrt_dynamic_noinf_nozero
+; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @ret_sqrt_dynamic_noinf_nozero
; CHECK-SAME: (float nofpclass(inf zero) [[ARG0:%.*]]) #[[ATTR5:[0-9]+]] {
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sqrt.f32(float %arg0)
@@ -181,9 +181,9 @@ define float @ret_sqrt_dynamic_noinf_nozero(float nofpclass(inf zero) %arg0) #3
}
define float @ret_sqrt_dynamic_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #3 {
-; CHECK-LABEL: define float @ret_sqrt_dynamic_noinf_nonegzero
+; CHECK-LABEL: define nofpclass(inf nsub nnorm) float @ret_sqrt_dynamic_noinf_nonegzero
; CHECK-SAME: (float nofpclass(inf nzero) [[ARG0:%.*]]) #[[ATTR5]] {
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sqrt.f32(float %arg0)
@@ -191,9 +191,9 @@ define float @ret_sqrt_dynamic_noinf_nonegzero(float nofpclass(inf nzero) %arg0)
}
define float @ret_sqrt_ftz_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #4 {
-; CHECK-LABEL: define float @ret_sqrt_ftz_noinf_nonegzero
+; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_ftz_noinf_nonegzero
; CHECK-SAME: (float nofpclass(inf nzero) [[ARG0:%.*]]) #[[ATTR6:[0-9]+]] {
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sqrt.f32(float %arg0)
@@ -201,9 +201,9 @@ define float @ret_sqrt_ftz_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #4
}
define float @ret_sqrt_ftpz_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #5 {
-; CHECK-LABEL: define float @ret_sqrt_ftpz_noinf_nonegzero
+; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_ftpz_noinf_nonegzero
; CHECK-SAME: (float nofpclass(inf nzero) [[ARG0:%.*]]) #[[ATTR7:[0-9]+]] {
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sqrt.f32(float %arg0)
@@ -211,9 +211,9 @@ define float @ret_sqrt_ftpz_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #5
}
define float @ret_sqrt_ftz_dynamic_noinf_nonegzero(float nofpclass(inf nzero) %arg0) #6 {
-; CHECK-LABEL: define float @ret_sqrt_ftz_dynamic_noinf_nonegzero
+; CHECK-LABEL: define nofpclass(inf nzero nsub nnorm) float @ret_sqrt_ftz_dynamic_noinf_nonegzero
; CHECK-SAME: (float nofpclass(inf nzero) [[ARG0:%.*]]) #[[ATTR8:[0-9]+]] {
-; CHECK-NEXT: [[CALL:%.*]] = call float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
+; CHECK-NEXT: [[CALL:%.*]] = call nofpclass(inf nzero nsub nnorm) float @llvm.sqrt.f32(float [[ARG0]]) #[[ATTR10]]
; CHECK-NEXT: ret float [[CALL]]
;
%call = call float @llvm.sqrt.f32(float %arg0)
diff --git a/llvm/unittests/Analysis/ValueTrackingTest.cpp b/llvm/unittests/Analysis/ValueTrackingTest.cpp
index 6a8f468a9c330..c83fb62830d0f 100644
--- a/llvm/unittests/Analysis/ValueTrackingTest.cpp
+++ b/llvm/unittests/Analysis/ValueTrackingTest.cpp
@@ -1512,10 +1512,10 @@ TEST_F(ComputeKnownFPClassTest, CopySignNNanSrc0) {
TEST_F(ComputeKnownFPClassTest, CopySignNInfSrc0_NegSign) {
parseAssembly(
- "declare float @llvm.sqrt.f32(float)\n"
+ "declare float @llvm.log.f32(float)\n"
"declare float @llvm.copysign.f32(float, float)\n"
"define float @test(float %arg0, float %arg1) {\n"
- " %ninf = call ninf float @llvm.sqrt.f32(float %arg0)"
+ " %ninf = call ninf float @llvm.log.f32(float %arg0)"
" %A = call float @llvm.copysign.f32(float %ninf, float -1.0)"
" ret float %A\n"
"}\n");
More information about the llvm-commits
mailing list