Skip to content

Commit 5e7ad63

Browse files
authored
[FuzzMutate] Match the callee's and callsite's calling conventions. (llvm#139100)
The mutator can generate calls with undefined behavior because it is not matching the calling conventions.
1 parent f638f86 commit 5e7ad63

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

llvm/lib/FuzzMutate/IRMutator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,7 @@ void InsertFunctionStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
391391
BasicBlock::iterator InsertPt) {
392392
StringRef Name = isRetVoid ? nullptr : "C";
393393
CallInst *Call = CallInst::Create(FTy, F, Srcs, Name, InsertPt);
394+
Call->setCallingConv(F->getCallingConv());
394395
// Don't return this call inst if it return void as it can't be sinked.
395396
return isRetVoid ? nullptr : Call;
396397
};

0 commit comments

Comments
 (0)