[llvm] f638f86 - [FuzzMutate] Prevent the mutator from generating invalid IR caused by non-callable CCs (#139080)

via llvm-commits llvm-commits at lists.llvm.org
Mon May 12 10:14:53 PDT 2025


Author: Manuel Carrasco
Date: 2025-05-12T10:14:49-07:00
New Revision: f638f86384691052c30eda074e6d199d5a691223

URL: https://github.com/llvm/llvm-project/commit/f638f86384691052c30eda074e6d199d5a691223
DIFF: https://github.com/llvm/llvm-project/commit/f638f86384691052c30eda074e6d199d5a691223.diff

LOG: [FuzzMutate] Prevent the mutator from generating invalid IR caused by non-callable CCs (#139080)

The current implementation can generate invalid IR due to illegal use of
CCs. This matches the behaviour of the IRVerifier.

Added: 
    

Modified: 
    llvm/lib/FuzzMutate/IRMutator.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/FuzzMutate/IRMutator.cpp b/llvm/lib/FuzzMutate/IRMutator.cpp
index 7e28f58046b1f..d5535ee9aaf66 100644
--- a/llvm/lib/FuzzMutate/IRMutator.cpp
+++ b/llvm/lib/FuzzMutate/IRMutator.cpp
@@ -374,7 +374,8 @@ void InsertFunctionStrategy::mutate(BasicBlock &BB, RandomIRBuilder &IB) {
     return T->isMetadataTy() || T->isTokenTy();
   };
   if (!F || IsUnsupportedTy(F->getReturnType()) ||
-      any_of(F->getFunctionType()->params(), IsUnsupportedTy)) {
+      any_of(F->getFunctionType()->params(), IsUnsupportedTy) ||
+      !isCallableCC(F->getCallingConv())) {
     F = IB.createFunctionDeclaration(*M);
   }
 


        


More information about the llvm-commits mailing list