Skip to content

Commit f78b4f6

Browse files
committed
[IR] Make @llvm.memset prototype byte width dependent
This patch changes the type of the value argument of @llvm.memset and similar intrinsics from i8 to iN, where N is the byte width specified in data layout string. Note that the argument still has fixed type (not overloaded), but type checker will complain if the type does not match the byte width. Ideally, the type of the argument would be dependent on the address space of the pointer argument. It is easy to do this (and I did it downstream as a PoC), but since data layout string doesn't currently allow different byte widths for different address spaces, I refrained from doing it now.
1 parent 98c3676 commit f78b4f6

File tree

11 files changed

+67
-49
lines changed

11 files changed

+67
-49
lines changed

llvm/include/llvm-c/Core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2820,7 +2820,7 @@ LLVMValueRef LLVMGetIntrinsicDeclaration(LLVMModuleRef Mod,
28202820
*
28212821
* @see llvm::Intrinsic::getType()
28222822
*/
2823-
LLVMTypeRef LLVMIntrinsicGetType(LLVMContextRef Ctx, unsigned ID,
2823+
LLVMTypeRef LLVMIntrinsicGetType(LLVMModuleRef Mod, unsigned ID,
28242824
LLVMTypeRef *ParamTypes, size_t ParamCount);
28252825

28262826
/**

llvm/include/llvm/IR/Intrinsics.h

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
namespace llvm {
2424

25+
class DataLayout;
2526
class Type;
2627
class FunctionType;
2728
class Function;
@@ -73,8 +74,7 @@ namespace Intrinsic {
7374
std::string getNameNoUnnamedTypes(ID Id, ArrayRef<Type *> Tys);
7475

7576
/// Return the function type for an intrinsic.
76-
FunctionType *getType(LLVMContext &Context, ID id,
77-
ArrayRef<Type *> Tys = std::nullopt);
77+
FunctionType *getType(Module *M, ID id, ArrayRef<Type *> Tys = std::nullopt);
7878

7979
/// Returns true if the intrinsic can be overloaded.
8080
bool isOverloaded(ID id);
@@ -118,6 +118,7 @@ namespace Intrinsic {
118118
struct IITDescriptor {
119119
enum IITDescriptorKind {
120120
Void,
121+
Byte,
121122
VarArg,
122123
MMX,
123124
Token,
@@ -226,7 +227,8 @@ namespace Intrinsic {
226227
/// Returns false if the given type matches with the constraints, true
227228
/// otherwise.
228229
MatchIntrinsicTypesResult
229-
matchIntrinsicSignature(FunctionType *FTy, ArrayRef<IITDescriptor> &Infos,
230+
matchIntrinsicSignature(const DataLayout &DL, FunctionType *FTy,
231+
ArrayRef<IITDescriptor> &Infos,
230232
SmallVectorImpl<Type *> &ArgTys);
231233

232234
/// Verify if the intrinsic has variable arguments. This method is intended to
@@ -241,8 +243,8 @@ namespace Intrinsic {
241243
///
242244
/// Returns false if the given ID and function type combination is not a
243245
/// valid intrinsic call.
244-
bool getIntrinsicSignature(Intrinsic::ID, FunctionType *FT,
245-
SmallVectorImpl<Type *> &ArgTys);
246+
bool getIntrinsicSignature(const DataLayout &DL, Intrinsic::ID,
247+
FunctionType *FT, SmallVectorImpl<Type *> &ArgTys);
246248

247249
/// Same as previous, but accepts a Function instead of ID and FunctionType.
248250
bool getIntrinsicSignature(Function *F, SmallVectorImpl<Type *> &ArgTys);

llvm/include/llvm/IR/Intrinsics.td

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,7 @@ def IIT_V1 : IIT_Vec<1, 28>;
294294
def IIT_VARARG : IIT_VT<isVoid, 29>;
295295
def IIT_HALF_VEC_ARG : IIT_Base<30>;
296296
def IIT_SAME_VEC_WIDTH_ARG : IIT_Base<31>;
297+
def IIT_BYTE : IIT_Base<32>;
297298
def IIT_VEC_OF_ANYPTRS_TO_ELT : IIT_Base<34>;
298299
def IIT_I128 : IIT_Int<128, 35>;
299300
def IIT_V512 : IIT_Vec<512, 36>;
@@ -372,6 +373,10 @@ class LLVMType<ValueType vt> {
372373
!foreach(iit, IITs, iit.Number));
373374
}
374375

376+
class LLVMByteType : LLVMType<OtherVT> {
377+
let Sig = [IIT_BYTE.Number];
378+
}
379+
375380
class LLVMAnyType<ValueType vt> : LLVMType<vt> {
376381
let ArgCode = !cond(
377382
!eq(vt, Any) : ArgKind.Any,
@@ -471,7 +476,7 @@ class LLVMVectorOfBitcastsToInt<int num>
471476
: LLVMMatchType<num, IIT_VEC_OF_BITCASTS_TO_INT>;
472477

473478
def llvm_void_ty : LLVMType<isVoid>;
474-
479+
def llvm_byte_ty : LLVMByteType;
475480
def llvm_any_ty : LLVMAnyType<Any>;
476481
def llvm_anyint_ty : LLVMAnyType<iAny>;
477482
def llvm_anyfloat_ty : LLVMAnyType<fAny>;
@@ -984,7 +989,7 @@ def int_memmove : Intrinsic<[],
984989
WriteOnly<ArgIndex<0>>, ReadOnly<ArgIndex<1>>,
985990
ImmArg<ArgIndex<3>>]>;
986991
def int_memset : Intrinsic<[],
987-
[llvm_anyptr_ty, llvm_i8_ty, llvm_anyint_ty,
992+
[llvm_anyptr_ty, llvm_byte_ty, llvm_anyint_ty,
988993
llvm_i1_ty],
989994
[IntrWriteMem, IntrArgMemOnly, IntrWillReturn,
990995
IntrNoFree, IntrNoCallback,
@@ -997,7 +1002,7 @@ def int_memset : Intrinsic<[],
9971002
// The third argument (specifying the size) must be a constant.
9981003
def int_memset_inline
9991004
: Intrinsic<[],
1000-
[llvm_anyptr_ty, llvm_i8_ty, llvm_anyint_ty, llvm_i1_ty],
1005+
[llvm_anyptr_ty, llvm_byte_ty, llvm_anyint_ty, llvm_i1_ty],
10011006
[IntrWriteMem, IntrArgMemOnly, IntrWillReturn, IntrNoFree, IntrNoCallback,
10021007
NoCapture<ArgIndex<0>>, WriteOnly<ArgIndex<0>>,
10031008
ImmArg<ArgIndex<3>>]>;
@@ -2506,7 +2511,7 @@ def int_memmove_element_unordered_atomic
25062511

25072512
// @llvm.memset.element.unordered.atomic.*(dest, value, length, elementsize)
25082513
def int_memset_element_unordered_atomic
2509-
: Intrinsic<[], [llvm_anyptr_ty, llvm_i8_ty, llvm_anyint_ty, llvm_i32_ty],
2514+
: Intrinsic<[], [llvm_anyptr_ty, llvm_byte_ty, llvm_anyint_ty, llvm_i32_ty],
25102515
[IntrWriteMem, IntrArgMemOnly, IntrWillReturn, IntrNoSync,
25112516
NoCapture<ArgIndex<0>>, WriteOnly<ArgIndex<0>>,
25122517
ImmArg<ArgIndex<3>>]>;

llvm/lib/AsmParser/LLParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,8 @@ bool LLParser::validateEndOfModule(bool UpgradeDebugInfo) {
356356
return error(Info.second, "intrinsic can only be used as callee");
357357

358358
SmallVector<Type *> OverloadTys;
359-
if (!Intrinsic::getIntrinsicSignature(IID, CB->getFunctionType(),
360-
OverloadTys))
359+
if (!Intrinsic::getIntrinsicSignature(
360+
M->getDataLayout(), IID, CB->getFunctionType(), OverloadTys))
361361
return error(Info.second, "invalid intrinsic signature");
362362

363363
U.set(Intrinsic::getDeclaration(M, IID, OverloadTys));

llvm/lib/IR/Core.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2476,11 +2476,11 @@ const char *LLVMIntrinsicGetName(unsigned ID, size_t *NameLength) {
24762476
return Str.data();
24772477
}
24782478

2479-
LLVMTypeRef LLVMIntrinsicGetType(LLVMContextRef Ctx, unsigned ID,
2479+
LLVMTypeRef LLVMIntrinsicGetType(LLVMModuleRef Mod, unsigned ID,
24802480
LLVMTypeRef *ParamTypes, size_t ParamCount) {
24812481
auto IID = llvm_map_to_intrinsic_id(ID);
24822482
ArrayRef<Type*> Tys(unwrap(ParamTypes), ParamCount);
2483-
return wrap(llvm::Intrinsic::getType(*unwrap(Ctx), IID, Tys));
2483+
return wrap(llvm::Intrinsic::getType(unwrap(Mod), IID, Tys));
24842484
}
24852485

24862486
const char *LLVMIntrinsicCopyOverloadedName(unsigned ID,

llvm/lib/IR/Function.cpp

Lines changed: 40 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1118,9 +1118,9 @@ static std::string getIntrinsicNameImpl(Intrinsic::ID Id, ArrayRef<Type *> Tys,
11181118
if (HasUnnamedType) {
11191119
assert(M && "unnamed types need a module");
11201120
if (!FT)
1121-
FT = Intrinsic::getType(M->getContext(), Id, Tys);
1121+
FT = Intrinsic::getType(M, Id, Tys);
11221122
else
1123-
assert((FT == Intrinsic::getType(M->getContext(), Id, Tys)) &&
1123+
assert((FT == Intrinsic::getType(M, Id, Tys)) &&
11241124
"Provided FunctionType must match arguments");
11251125
return M->getUniqueIntrinsicName(Result, Id, FT);
11261126
}
@@ -1161,6 +1161,9 @@ static void DecodeIITType(unsigned &NextElt, ArrayRef<unsigned char> Infos,
11611161
case IIT_Done:
11621162
OutputTable.push_back(IITDescriptor::get(IITDescriptor::Void, 0));
11631163
return;
1164+
case IIT_BYTE:
1165+
OutputTable.push_back(IITDescriptor::get(IITDescriptor::Byte, 0));
1166+
return;
11641167
case IIT_VARARG:
11651168
OutputTable.push_back(IITDescriptor::get(IITDescriptor::VarArg, 0));
11661169
return;
@@ -1413,14 +1416,17 @@ void Intrinsic::getIntrinsicInfoTableEntries(ID id,
14131416
}
14141417

14151418
static Type *DecodeFixedType(ArrayRef<Intrinsic::IITDescriptor> &Infos,
1416-
ArrayRef<Type*> Tys, LLVMContext &Context) {
1419+
ArrayRef<Type *> Tys, LLVMContext &Context,
1420+
const DataLayout &DL) {
14171421
using namespace Intrinsic;
14181422

14191423
IITDescriptor D = Infos.front();
14201424
Infos = Infos.slice(1);
14211425

14221426
switch (D.Kind) {
14231427
case IITDescriptor::Void: return Type::getVoidTy(Context);
1428+
case IITDescriptor::Byte:
1429+
return Type::getIntNTy(Context, DL.getByteWidth());
14241430
case IITDescriptor::VarArg: return Type::getVoidTy(Context);
14251431
case IITDescriptor::MMX:
14261432
return llvm::FixedVectorType::get(llvm::IntegerType::get(Context, 64), 1);
@@ -1439,14 +1445,14 @@ static Type *DecodeFixedType(ArrayRef<Intrinsic::IITDescriptor> &Infos,
14391445
case IITDescriptor::Integer:
14401446
return IntegerType::get(Context, D.Integer_Width);
14411447
case IITDescriptor::Vector:
1442-
return VectorType::get(DecodeFixedType(Infos, Tys, Context),
1448+
return VectorType::get(DecodeFixedType(Infos, Tys, Context, DL),
14431449
D.Vector_Width);
14441450
case IITDescriptor::Pointer:
14451451
return PointerType::get(Context, D.Pointer_AddressSpace);
14461452
case IITDescriptor::Struct: {
14471453
SmallVector<Type *, 8> Elts;
14481454
for (unsigned i = 0, e = D.Struct_NumElements; i != e; ++i)
1449-
Elts.push_back(DecodeFixedType(Infos, Tys, Context));
1455+
Elts.push_back(DecodeFixedType(Infos, Tys, Context, DL));
14501456
return StructType::get(Context, Elts);
14511457
}
14521458
case IITDescriptor::Argument:
@@ -1479,7 +1485,7 @@ static Type *DecodeFixedType(ArrayRef<Intrinsic::IITDescriptor> &Infos,
14791485
return VectorType::getHalfElementsVectorType(cast<VectorType>(
14801486
Tys[D.getArgumentNumber()]));
14811487
case IITDescriptor::SameVecWidthArgument: {
1482-
Type *EltTy = DecodeFixedType(Infos, Tys, Context);
1488+
Type *EltTy = DecodeFixedType(Infos, Tys, Context, DL);
14831489
Type *Ty = Tys[D.getArgumentNumber()];
14841490
if (auto *VTy = dyn_cast<VectorType>(Ty))
14851491
return VectorType::get(EltTy, VTy->getElementCount());
@@ -1504,17 +1510,18 @@ static Type *DecodeFixedType(ArrayRef<Intrinsic::IITDescriptor> &Infos,
15041510
llvm_unreachable("unhandled");
15051511
}
15061512

1507-
FunctionType *Intrinsic::getType(LLVMContext &Context,
1508-
ID id, ArrayRef<Type*> Tys) {
1513+
FunctionType *Intrinsic::getType(Module *M, ID id, ArrayRef<Type *> Tys) {
15091514
SmallVector<IITDescriptor, 8> Table;
15101515
getIntrinsicInfoTableEntries(id, Table);
15111516

15121517
ArrayRef<IITDescriptor> TableRef = Table;
1513-
Type *ResultTy = DecodeFixedType(TableRef, Tys, Context);
1518+
Type *ResultTy =
1519+
DecodeFixedType(TableRef, Tys, M->getContext(), M->getDataLayout());
15141520

15151521
SmallVector<Type*, 8> ArgTys;
15161522
while (!TableRef.empty())
1517-
ArgTys.push_back(DecodeFixedType(TableRef, Tys, Context));
1523+
ArgTys.push_back(
1524+
DecodeFixedType(TableRef, Tys, M->getContext(), M->getDataLayout()));
15181525

15191526
// DecodeFixedType returns Void for IITDescriptor::Void and IITDescriptor::VarArg
15201527
// If we see void type as the type of the last argument, it is vararg intrinsic
@@ -1539,7 +1546,7 @@ bool Intrinsic::isOverloaded(ID id) {
15391546
Function *Intrinsic::getDeclaration(Module *M, ID id, ArrayRef<Type*> Tys) {
15401547
// There can never be multiple globals with the same name of different types,
15411548
// because intrinsics must be a specific type.
1542-
auto *FT = getType(M->getContext(), id, Tys);
1549+
auto *FT = getType(M, id, Tys);
15431550
return cast<Function>(
15441551
M->getOrInsertFunction(
15451552
Tys.empty() ? getName(id) : getName(id, Tys, M, FT), FT)
@@ -1583,11 +1590,12 @@ bool Intrinsic::hasConstrainedFPRoundingModeOperand(Intrinsic::ID QID) {
15831590
using DeferredIntrinsicMatchPair =
15841591
std::pair<Type *, ArrayRef<Intrinsic::IITDescriptor>>;
15851592

1586-
static bool matchIntrinsicType(
1587-
Type *Ty, ArrayRef<Intrinsic::IITDescriptor> &Infos,
1588-
SmallVectorImpl<Type *> &ArgTys,
1589-
SmallVectorImpl<DeferredIntrinsicMatchPair> &DeferredChecks,
1590-
bool IsDeferredCheck) {
1593+
static bool
1594+
matchIntrinsicType(const DataLayout &DL, Type *Ty,
1595+
ArrayRef<Intrinsic::IITDescriptor> &Infos,
1596+
SmallVectorImpl<Type *> &ArgTys,
1597+
SmallVectorImpl<DeferredIntrinsicMatchPair> &DeferredChecks,
1598+
bool IsDeferredCheck) {
15911599
using namespace Intrinsic;
15921600

15931601
// If we ran out of descriptors, there are too many arguments.
@@ -1605,6 +1613,8 @@ static bool matchIntrinsicType(
16051613

16061614
switch (D.Kind) {
16071615
case IITDescriptor::Void: return !Ty->isVoidTy();
1616+
case IITDescriptor::Byte:
1617+
return !Ty->isIntegerTy(DL.getByteWidth());
16081618
case IITDescriptor::VarArg: return true;
16091619
case IITDescriptor::MMX: {
16101620
FixedVectorType *VT = dyn_cast<FixedVectorType>(Ty);
@@ -1627,7 +1637,7 @@ static bool matchIntrinsicType(
16271637
case IITDescriptor::Vector: {
16281638
VectorType *VT = dyn_cast<VectorType>(Ty);
16291639
return !VT || VT->getElementCount() != D.Vector_Width ||
1630-
matchIntrinsicType(VT->getElementType(), Infos, ArgTys,
1640+
matchIntrinsicType(DL, VT->getElementType(), Infos, ArgTys,
16311641
DeferredChecks, IsDeferredCheck);
16321642
}
16331643
case IITDescriptor::Pointer: {
@@ -1642,7 +1652,7 @@ static bool matchIntrinsicType(
16421652
return true;
16431653

16441654
for (unsigned i = 0, e = D.Struct_NumElements; i != e; ++i)
1645-
if (matchIntrinsicType(ST->getElementType(i), Infos, ArgTys,
1655+
if (matchIntrinsicType(DL, ST->getElementType(i), Infos, ArgTys,
16461656
DeferredChecks, IsDeferredCheck))
16471657
return true;
16481658
return false;
@@ -1727,7 +1737,7 @@ static bool matchIntrinsicType(
17271737
return true;
17281738
EltTy = ThisArgType->getElementType();
17291739
}
1730-
return matchIntrinsicType(EltTy, Infos, ArgTys, DeferredChecks,
1740+
return matchIntrinsicType(DL, EltTy, Infos, ArgTys, DeferredChecks,
17311741
IsDeferredCheck);
17321742
}
17331743
case IITDescriptor::VecOfAnyPtrsToElt: {
@@ -1791,24 +1801,24 @@ static bool matchIntrinsicType(
17911801
}
17921802

17931803
Intrinsic::MatchIntrinsicTypesResult
1794-
Intrinsic::matchIntrinsicSignature(FunctionType *FTy,
1804+
Intrinsic::matchIntrinsicSignature(const DataLayout &DL, FunctionType *FTy,
17951805
ArrayRef<Intrinsic::IITDescriptor> &Infos,
17961806
SmallVectorImpl<Type *> &ArgTys) {
17971807
SmallVector<DeferredIntrinsicMatchPair, 2> DeferredChecks;
1798-
if (matchIntrinsicType(FTy->getReturnType(), Infos, ArgTys, DeferredChecks,
1799-
false))
1808+
if (matchIntrinsicType(DL, FTy->getReturnType(), Infos, ArgTys,
1809+
DeferredChecks, false))
18001810
return MatchIntrinsicTypes_NoMatchRet;
18011811

18021812
unsigned NumDeferredReturnChecks = DeferredChecks.size();
18031813

18041814
for (auto *Ty : FTy->params())
1805-
if (matchIntrinsicType(Ty, Infos, ArgTys, DeferredChecks, false))
1815+
if (matchIntrinsicType(DL, Ty, Infos, ArgTys, DeferredChecks, false))
18061816
return MatchIntrinsicTypes_NoMatchArg;
18071817

18081818
for (unsigned I = 0, E = DeferredChecks.size(); I != E; ++I) {
18091819
DeferredIntrinsicMatchPair &Check = DeferredChecks[I];
1810-
if (matchIntrinsicType(Check.first, Check.second, ArgTys, DeferredChecks,
1811-
true))
1820+
if (matchIntrinsicType(DL, Check.first, Check.second, ArgTys,
1821+
DeferredChecks, true))
18121822
return I < NumDeferredReturnChecks ? MatchIntrinsicTypes_NoMatchRet
18131823
: MatchIntrinsicTypes_NoMatchArg;
18141824
}
@@ -1836,7 +1846,8 @@ Intrinsic::matchIntrinsicVarArg(bool isVarArg,
18361846
return true;
18371847
}
18381848

1839-
bool Intrinsic::getIntrinsicSignature(Intrinsic::ID ID, FunctionType *FT,
1849+
bool Intrinsic::getIntrinsicSignature(const DataLayout &DL, Intrinsic::ID ID,
1850+
FunctionType *FT,
18401851
SmallVectorImpl<Type *> &ArgTys) {
18411852
if (!ID)
18421853
return false;
@@ -1845,7 +1856,7 @@ bool Intrinsic::getIntrinsicSignature(Intrinsic::ID ID, FunctionType *FT,
18451856
getIntrinsicInfoTableEntries(ID, Table);
18461857
ArrayRef<Intrinsic::IITDescriptor> TableRef = Table;
18471858

1848-
if (Intrinsic::matchIntrinsicSignature(FT, TableRef, ArgTys) !=
1859+
if (Intrinsic::matchIntrinsicSignature(DL, FT, TableRef, ArgTys) !=
18491860
Intrinsic::MatchIntrinsicTypesResult::MatchIntrinsicTypes_Match) {
18501861
return false;
18511862
}
@@ -1856,8 +1867,8 @@ bool Intrinsic::getIntrinsicSignature(Intrinsic::ID ID, FunctionType *FT,
18561867

18571868
bool Intrinsic::getIntrinsicSignature(Function *F,
18581869
SmallVectorImpl<Type *> &ArgTys) {
1859-
return getIntrinsicSignature(F->getIntrinsicID(), F->getFunctionType(),
1860-
ArgTys);
1870+
return getIntrinsicSignature(F->getDataLayout(), F->getIntrinsicID(),
1871+
F->getFunctionType(), ArgTys);
18611872
}
18621873

18631874
std::optional<Function *> Intrinsic::remangleIntrinsicFunction(Function *F) {

llvm/lib/IR/IRBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -957,7 +957,7 @@ CallInst *IRBuilderBase::CreateIntrinsic(Type *RetTy, Intrinsic::ID ID,
957957
FunctionType *FTy = FunctionType::get(RetTy, ArgTys, false);
958958
SmallVector<Type *> OverloadTys;
959959
Intrinsic::MatchIntrinsicTypesResult Res =
960-
matchIntrinsicSignature(FTy, TableRef, OverloadTys);
960+
matchIntrinsicSignature(M->getDataLayout(), FTy, TableRef, OverloadTys);
961961
(void)Res;
962962
assert(Res == Intrinsic::MatchIntrinsicTypes_Match && TableRef.empty() &&
963963
"Wrong types for intrinsic!");

llvm/lib/IR/Verifier.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5295,7 +5295,7 @@ void Verifier::visitIntrinsicCall(Intrinsic::ID ID, CallBase &Call) {
52955295
// Walk the descriptors to extract overloaded types.
52965296
SmallVector<Type *, 4> ArgTys;
52975297
Intrinsic::MatchIntrinsicTypesResult Res =
5298-
Intrinsic::matchIntrinsicSignature(IFTy, TableRef, ArgTys);
5298+
Intrinsic::matchIntrinsicSignature(DL, IFTy, TableRef, ArgTys);
52995299
Check(Res != Intrinsic::MatchIntrinsicTypes_NoMatchRet,
53005300
"Intrinsic has incorrect return type!", IF);
53015301
Check(Res != Intrinsic::MatchIntrinsicTypes_NoMatchArg,

llvm/lib/Transforms/IPO/ExpandVariadics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ class VariadicABIInfo {
145145
// function here in the meantime to decouple from that discussion.
146146
Function *getPreexistingDeclaration(Module *M, Intrinsic::ID Id,
147147
ArrayRef<Type *> Tys = {}) {
148-
auto *FT = Intrinsic::getType(M->getContext(), Id, Tys);
148+
auto *FT = Intrinsic::getType(M, Id, Tys);
149149
return M->getFunction(Tys.empty() ? Intrinsic::getName(Id)
150150
: Intrinsic::getName(Id, Tys, M, FT));
151151
}

llvm/lib/Transforms/Instrumentation/NumericalStabilitySanitizer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1591,7 +1591,7 @@ Value *NumericalStabilitySanitizer::maybeHandleKnownCallBase(
15911591
SmallVector<Type *, 4> ArgTys;
15921592
ArrayRef<Intrinsic::IITDescriptor> TableRef = Table;
15931593
[[maybe_unused]] Intrinsic::MatchIntrinsicTypesResult MatchResult =
1594-
Intrinsic::matchIntrinsicSignature(WidenedFnTy, TableRef, ArgTys);
1594+
Intrinsic::matchIntrinsicSignature(DL, WidenedFnTy, TableRef, ArgTys);
15951595
assert(MatchResult == Intrinsic::MatchIntrinsicTypes_Match &&
15961596
"invalid widened intrinsic");
15971597
// For known intrinsic functions, we create a second call to the same

0 commit comments

Comments
 (0)