diff options
author | Kevin P. Neal <kevin.neal@sas.com> | 2024-04-17 08:34:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-17 08:34:25 -0400 |
commit | 79726ef5d20f3bf6510b67d7dd3378b8a41db768 (patch) | |
tree | 5de6283a32ad008923d9bbc32c4ab45d15d30007 /llvm/lib/IR/Function.cpp | |
parent | 915c84b1480bb3c6d2e44ca83822d2c2304b763a (diff) | |
download | llvm-79726ef5d20f3bf6510b67d7dd3378b8a41db768.zip llvm-79726ef5d20f3bf6510b67d7dd3378b8a41db768.tar.gz llvm-79726ef5d20f3bf6510b67d7dd3378b8a41db768.tar.bz2 |
[VP] Correct lowering of predicated fma and faddmul to avoid strictfp. (#85272)
Correct missing cases in a switch that result in @llvm.vp.fma.v4f32
getting lowered to a constrained fma intrinsic. Vector predicated
lowering to contrained intrinsics is not supported currently, and
there's no consensus on the path forward. We certainly shouldn't be
introducing constrained intrinsics into a function that isn't strictfp.
Problem found with D146845.
Diffstat (limited to 'llvm/lib/IR/Function.cpp')
-rw-r--r-- | llvm/lib/IR/Function.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/llvm/lib/IR/Function.cpp b/llvm/lib/IR/Function.cpp index 96953ac..818a167 100644 --- a/llvm/lib/IR/Function.cpp +++ b/llvm/lib/IR/Function.cpp @@ -499,15 +499,7 @@ static MutableArrayRef<Argument> makeArgArray(Argument *Args, size_t Count) { } bool Function::isConstrainedFPIntrinsic() const { - switch (getIntrinsicID()) { -#define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \ - case Intrinsic::INTRINSIC: -#include "llvm/IR/ConstrainedOps.def" - return true; -#undef INSTRUCTION - default: - return false; - } + return Intrinsic::isConstrainedFPIntrinsic(getIntrinsicID()); } void Function::clearArguments() { @@ -1486,6 +1478,18 @@ Function *Intrinsic::getDeclaration(Module *M, ID id, ArrayRef<Type*> Tys) { #include "llvm/IR/IntrinsicImpl.inc" #undef GET_LLVM_INTRINSIC_FOR_MS_BUILTIN +bool Intrinsic::isConstrainedFPIntrinsic(ID QID) { + switch (QID) { +#define INSTRUCTION(NAME, NARG, ROUND_MODE, INTRINSIC) \ + case Intrinsic::INTRINSIC: +#include "llvm/IR/ConstrainedOps.def" + return true; +#undef INSTRUCTION + default: + return false; + } +} + using DeferredIntrinsicMatchPair = std::pair<Type *, ArrayRef<Intrinsic::IITDescriptor>>; |