diff options
author | ostannard <oliver.stannard@arm.com> | 2024-02-13 09:13:22 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-13 09:13:22 +0000 |
commit | 44706bd4f0e26f86eda24e4888044897fd4f92a8 (patch) | |
tree | 95dfddacaeae2a379ae84c0344373c47c495ef83 /llvm/lib | |
parent | d860ea96b1d4bcc13bf269e9b108d8f5e0c21d93 (diff) | |
download | llvm-44706bd4f0e26f86eda24e4888044897fd4f92a8.zip llvm-44706bd4f0e26f86eda24e4888044897fd4f92a8.tar.gz llvm-44706bd4f0e26f86eda24e4888044897fd4f92a8.tar.bz2 |
[InstCombine] Don't add fcmp instructions to strictfp functions (#81498)
The strictfp attribute has the requirement that "LLVM will not introduce
any new floating-point instructions that may trap". The llvm.is.fpclass
intrinsic is documented as "The function never raises floating-point
exceptions", and the fcmp instruction may raise one, so we can't
transform the former into the latter in functions with the strictfp
attribute.
Diffstat (limited to 'llvm/lib')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp index 56d1259..5266808 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp @@ -902,7 +902,8 @@ Instruction *InstCombinerImpl::foldIntrinsicIsFPClass(IntrinsicInst &II) { const FPClassTest OrderedMask = Mask & ~fcNan; const FPClassTest OrderedInvertedMask = ~OrderedMask & ~fcNan; - const bool IsStrict = II.isStrictFP(); + const bool IsStrict = + II.getFunction()->getAttributes().hasFnAttr(Attribute::StrictFP); Value *FNegSrc; if (match(Src0, m_FNeg(m_Value(FNegSrc)))) { |