================
@@ -3011,6 +3016,37 @@ void CodeGenModule::ConstructAttributeList(StringRef 
Name,
   }
   assert(ArgNo == FI.arg_size());
 
+  ArgNo = 0;
+  if (AddedPotentialArgAccess && MemAttrForPtrArgs) {
+    llvm::SmallSet<unsigned, 8> ArgsToSkip;
+    if (IRFunctionArgs.hasSRetArg()) {
+      ArgsToSkip.insert(IRFunctionArgs.getSRetArgNo());
+    }
+    if (IRFunctionArgs.hasInallocaArg()) {
+      ArgsToSkip.insert(IRFunctionArgs.getInallocaArgNo());
+    }
+
+    for (CGFunctionInfo::const_arg_iterator I = FI.arg_begin(),
+                                            E = FI.arg_end();
+         I != E; ++I, ++ArgNo) {
+      if (I->info.getKind() == ABIArgInfo::Indirect) {
----------------
efriedma-quic wrote:

Looking through the kinds in clang/include/clang/CodeGen/CGFunctionInfo.h, I'm 
not sure Indirect is the only thing that needs to be handled specially.

I'd prefer to explicitly handle the cases you know are safe (Direct, Expand, 
CoerceAndExpand).

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

Reply via email to