Skip to content

[NFC][Clang][CodeGen] Remove vestigial assertion #127528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 17, 2025

Conversation

AlexVlx
Copy link
Contributor

@AlexVlx AlexVlx commented Feb 17, 2025

This removes a vestigial assertion, which would erroneously trigger even though we now correctly handle valid arg mismatches (

// The only plausible mismatch here would be for pointer address spaces,
), after #114062 went in.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:codegen IR generation bugs: mangling, exceptions, etc. labels Feb 17, 2025
@AlexVlx AlexVlx removed the clang Clang issues not falling into any other category label Feb 17, 2025
@llvmbot
Copy link
Member

llvmbot commented Feb 17, 2025

@llvm/pr-subscribers-clang

Author: Alex Voicu (AlexVlx)

Changes

This removes a vestigial assertion, which would erroneously trigger even though we now correctly handle valid arg mismatches (<

// The only plausible mismatch here would be for pointer address spaces,
>), after #114062 went in.


Full diff: https://github.com/llvm/llvm-project/pull/127528.diff

1 Files Affected:

  • (modified) clang/lib/CodeGen/CGCall.cpp (-16)
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index e6c2ac939eb88..47bfd470dbafb 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -5633,22 +5633,6 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
   if (!CallArgs.getCleanupsToDeactivate().empty())
     deactivateArgCleanupsBeforeCall(*this, CallArgs);
 
-  // Assert that the arguments we computed match up.  The IR verifier
-  // will catch this, but this is a common enough source of problems
-  // during IRGen changes that it's way better for debugging to catch
-  // it ourselves here.
-#ifndef NDEBUG
-  assert(IRCallArgs.size() == IRFuncTy->getNumParams() || IRFuncTy->isVarArg());
-  for (unsigned i = 0; i < IRCallArgs.size(); ++i) {
-    // Inalloca argument can have different type.
-    if (IRFunctionArgs.hasInallocaArg() &&
-        i == IRFunctionArgs.getInallocaArgNo())
-      continue;
-    if (i < IRFuncTy->getNumParams())
-      assert(IRCallArgs[i]->getType() == IRFuncTy->getParamType(i));
-  }
-#endif
-
   // Update the largest vector width if any arguments have vector types.
   for (unsigned i = 0; i < IRCallArgs.size(); ++i)
     LargestVectorWidth = std::max(LargestVectorWidth,

@llvmbot
Copy link
Member

llvmbot commented Feb 17, 2025

@llvm/pr-subscribers-clang-codegen

Author: Alex Voicu (AlexVlx)

Changes

This removes a vestigial assertion, which would erroneously trigger even though we now correctly handle valid arg mismatches (<

// The only plausible mismatch here would be for pointer address spaces,
>), after #114062 went in.


Full diff: https://github.com/llvm/llvm-project/pull/127528.diff

1 Files Affected:

  • (modified) clang/lib/CodeGen/CGCall.cpp (-16)
diff --git a/clang/lib/CodeGen/CGCall.cpp b/clang/lib/CodeGen/CGCall.cpp
index e6c2ac939eb88..47bfd470dbafb 100644
--- a/clang/lib/CodeGen/CGCall.cpp
+++ b/clang/lib/CodeGen/CGCall.cpp
@@ -5633,22 +5633,6 @@ RValue CodeGenFunction::EmitCall(const CGFunctionInfo &CallInfo,
   if (!CallArgs.getCleanupsToDeactivate().empty())
     deactivateArgCleanupsBeforeCall(*this, CallArgs);
 
-  // Assert that the arguments we computed match up.  The IR verifier
-  // will catch this, but this is a common enough source of problems
-  // during IRGen changes that it's way better for debugging to catch
-  // it ourselves here.
-#ifndef NDEBUG
-  assert(IRCallArgs.size() == IRFuncTy->getNumParams() || IRFuncTy->isVarArg());
-  for (unsigned i = 0; i < IRCallArgs.size(); ++i) {
-    // Inalloca argument can have different type.
-    if (IRFunctionArgs.hasInallocaArg() &&
-        i == IRFunctionArgs.getInallocaArgNo())
-      continue;
-    if (i < IRFuncTy->getNumParams())
-      assert(IRCallArgs[i]->getType() == IRFuncTy->getParamType(i));
-  }
-#endif
-
   // Update the largest vector width if any arguments have vector types.
   for (unsigned i = 0; i < IRCallArgs.size(); ++i)
     LargestVectorWidth = std::max(LargestVectorWidth,

Copy link
Contributor

@jhuber6 jhuber6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, since this is only for these call arguments which are handled in all cases now I presume.

@AlexVlx AlexVlx merged commit a7a3568 into llvm:main Feb 17, 2025
11 checks passed
@arsenm
Copy link
Contributor

arsenm commented Feb 18, 2025

Missing test for the case where this broke?

@arsenm arsenm added this to the LLVM 20.X Release milestone Feb 18, 2025
@tstellar
Copy link
Collaborator

Does this fix need to be backported?

@jhuber6
Copy link
Contributor

jhuber6 commented Feb 19, 2025

The fix will need to be backported, but I don't think this fixed it all the way so we'll need another follow-up.

@tstellar
Copy link
Collaborator

@jhuber6 Was the follow-up for this backported too?

@jhuber6
Copy link
Contributor

jhuber6 commented May 10, 2025

@jhuber6 Was the follow-up for this backported too?

I don't remember, sorry. I think the whole thing got reverted or something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:codegen IR generation bugs: mangling, exceptions, etc.
Projects
Status: Needs Fix
Development

Successfully merging this pull request may close these issues.

5 participants