================
@@ -11451,30 +11451,31 @@ static void printFunctionArgExts(const Function *F, 
raw_fd_ostream &OS) {
   OS << ")\n";
 }
 
-bool SystemZTargetLowering::isInternal(const Function *Fn) const {
-  std::map<const Function *, bool>::iterator Itr = IsInternalCache.find(Fn);
-  if (Itr == IsInternalCache.end())
-    Itr = IsInternalCache
-              .insert(std::pair<const Function *, bool>(
-                  Fn, (Fn->hasLocalLinkage() && !Fn->hasAddressTaken())))
-              .first;
-  return Itr->second;
+bool SystemZTargetLowering::enableNarrowIntArgsVerification() const {
+  if (!Subtarget.isTargetELF())
+    return false;
+
+  if (EnableIntArgExtCheck.getNumOccurrences())
+    return EnableIntArgExtCheck;
+
+#ifdef NDEBUG
+  return false;
+#endif
+
+  return getTargetMachine().Options.VerifyArgABICompliance;
 }
 
 void SystemZTargetLowering::
 verifyNarrowIntegerArgs_Call(const SmallVectorImpl<ISD::OutputArg> &Outs,
                              const Function *F, SDValue Callee) const {
-  // Temporarily only do the check when explicitly requested, until it can be
-  // enabled by default.
-  if (!EnableIntArgExtCheck)
+  if (!enableNarrowIntArgsVerification())
     return;
-
-  bool IsInternal = false;
   const Function *CalleeFn = nullptr;
   if (auto *G = dyn_cast<GlobalAddressSDNode>(Callee))
-    if ((CalleeFn = dyn_cast<Function>(G->getGlobal())))
-      IsInternal = isInternal(CalleeFn);
-  if (!IsInternal && !verifyNarrowIntegerArgs(Outs)) {
+    CalleeFn = dyn_cast<Function>(G->getGlobal());
+  if (CalleeFn && CalleeFn->getCallingConv() != CallingConv::C)
+    return;
----------------
uweigand wrote:

I think we should use the calling convention at the call site 
(`CLI.CallingConv`) here.  This is also available for indirect calls.  (For 
direct calls, if this doesn't match the convention of the callee, we have 
bigger problems anyway ...)

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

Reply via email to