================
@@ -253,6 +253,23 @@ llvm::Constant *CodeGenModule::getBuiltinLibFunction(const 
FunctionDecl *FD,
   return GetOrCreateLLVMFunction(Name, Ty, D, /*ForVTable=*/false);
 }
 
+void appendDefaultIntrinsicArgs(SmallVectorImpl<llvm::Value *> &Args,
+                                llvm::Function *F) {
+  llvm::FunctionType *FTy = F->getFunctionType();
+  if (Args.size() == FTy->getNumParams())
+    return;
+
+  auto [FirstDefault, Defaults] =
+      Intrinsic::getAllDefaultArgValues(F->getIntrinsicID());
+  for (unsigned I = Args.size(), E = FTy->getNumParams(); I != E; ++I) {
+    unsigned DefaultIdx = I - FirstDefault;
+    if (DefaultIdx < 0 || DefaultIdx >= Defaults.size())
----------------
erichkeane wrote:

Further, when could/should the 2nd thing happen?  Don't the intrinsics have a 
rule that we are guaranteed that all the 'end' arguments are default (ala C?).  
Should this `if` just be some sort of assert? 


https://github.com/llvm/llvm-project/pull/214667
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to