aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/IR/Attributes.cpp
diff options
context:
space:
mode:
authorBenjamin Maxwell <benjamin.maxwell@arm.com>2024-10-02 10:05:09 +0100
committerGitHub <noreply@github.com>2024-10-02 10:05:09 +0100
commit95f00a63ce68f5df4c8447fa418be9255898f9c6 (patch)
treed622b5c488e1b4522688930124e8b3881c83eb60 /llvm/lib/IR/Attributes.cpp
parent66f84c8b8a762832af39e91370018f8f8307a0fc (diff)
downloadllvm-95f00a63ce68f5df4c8447fa418be9255898f9c6.zip
llvm-95f00a63ce68f5df4c8447fa418be9255898f9c6.tar.gz
llvm-95f00a63ce68f5df4c8447fa418be9255898f9c6.tar.bz2
[IR] Allow fast math flags on calls with homogeneous FP struct types (#110506)
This extends FPMathOperator to allow calls that return literal structs of homogeneous floating-point or vector-of-floating-point types. The intended use case for this is to support FP intrinsics that return multiple values (such as `llvm.sincos`).
Diffstat (limited to 'llvm/lib/IR/Attributes.cpp')
-rw-r--r--llvm/lib/IR/Attributes.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/llvm/lib/IR/Attributes.cpp b/llvm/lib/IR/Attributes.cpp
index 692207e..c5874c58 100644
--- a/llvm/lib/IR/Attributes.cpp
+++ b/llvm/lib/IR/Attributes.cpp
@@ -28,6 +28,7 @@
#include "llvm/IR/ConstantRangeList.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/LLVMContext.h"
+#include "llvm/IR/Operator.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
@@ -2296,12 +2297,8 @@ bool AttrBuilder::operator==(const AttrBuilder &B) const {
/// Returns true if this is a type legal for the 'nofpclass' attribute. This
/// follows the same type rules as FPMathOperator.
-///
-/// TODO: Consider relaxing to any FP type struct fields.
bool AttributeFuncs::isNoFPClassCompatibleType(Type *Ty) {
- while (ArrayType *ArrTy = dyn_cast<ArrayType>(Ty))
- Ty = ArrTy->getElementType();
- return Ty->isFPOrFPVectorTy();
+ return FPMathOperator::isSupportedFloatingPointType(Ty);
}
/// Which attributes cannot be applied to a type.