@@ -957,8 +957,15 @@ static Type* getIntrinsicParamType(
957
957
case AMDGPULibFunc::EVENT:
958
958
T = PointerType::getUnqual (C);
959
959
break ;
960
- default :
961
- llvm_unreachable (" Unhandled param type" );
960
+ case AMDGPULibFunc::B8:
961
+ case AMDGPULibFunc::B16:
962
+ case AMDGPULibFunc::B32:
963
+ case AMDGPULibFunc::B64:
964
+ case AMDGPULibFunc::SIZE_MASK:
965
+ case AMDGPULibFunc::FLOAT:
966
+ case AMDGPULibFunc::INT:
967
+ case AMDGPULibFunc::UINT:
968
+ case AMDGPULibFunc::DUMMY:
962
969
return nullptr ;
963
970
}
964
971
if (P.VectorSize > 1 )
@@ -974,8 +981,13 @@ FunctionType *AMDGPUMangledLibFunc::getFunctionType(const Module &M) const {
974
981
std::vector<Type*> Args;
975
982
ParamIterator I (Leads, manglingRules[FuncId]);
976
983
Param P;
977
- while ((P=I.getNextParam ()).ArgType != 0 )
978
- Args.push_back (getIntrinsicParamType (C, P, true ));
984
+ while ((P = I.getNextParam ()).ArgType != 0 ) {
985
+ Type *ParamTy = getIntrinsicParamType (C, P, true );
986
+ if (!ParamTy)
987
+ return nullptr ;
988
+
989
+ Args.push_back (ParamTy);
990
+ }
979
991
980
992
return FunctionType::get (
981
993
getIntrinsicParamType (C, getRetType (FuncId, Leads), true ),
@@ -1001,10 +1013,15 @@ bool AMDGPULibFunc::isCompatibleSignature(const Module &M,
1001
1013
const FunctionType *CallTy) const {
1002
1014
const FunctionType *FuncTy = getFunctionType (M);
1003
1015
1004
- // FIXME: UnmangledFuncInfo does not have any type information other than the
1005
- // number of arguments.
1006
- if (!FuncTy)
1016
+ if (!FuncTy) {
1017
+ // Give up on mangled functions with unexpected types.
1018
+ if (AMDGPULibFuncBase::isMangled (getId ()))
1019
+ return false ;
1020
+
1021
+ // FIXME: UnmangledFuncInfo does not have any type information other than
1022
+ // the number of arguments.
1007
1023
return getNumArgs () == CallTy->getNumParams ();
1024
+ }
1008
1025
1009
1026
// Normally the types should exactly match.
1010
1027
if (FuncTy == CallTy)
0 commit comments