[llvm] [TLI] Add getLibFunc in TLI API that accepts an Instruction. (PR #75919)

Paul Walker via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 20 03:58:50 PST 2023


================
@@ -1149,6 +1149,18 @@ bool TargetLibraryInfoImpl::getLibFunc(const Function &FDecl,
   return isValidProtoForLibFunc(*FDecl.getFunctionType(), F, *M);
 }
 
+bool TargetLibraryInfoImpl::getLibFunc(const Instruction &I, LibFunc &F) const {
+  if (I.getOpcode() != Instruction::FRem)
+    return false;
+
+  Type *ScalarTy = I.getType()->getScalarType();
----------------
paulwalker-arm wrote:

I must have missed this before but this should just be `I.getType();` because otherwise you'll return a value for vector types, which would be wrong.

https://github.com/llvm/llvm-project/pull/75919


More information about the llvm-commits mailing list