[clang] 6e77ad1 - Add an assert in cpudispatch emit to try to track down an error.

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 12 10:31:44 PST 2022


Author: Erich Keane
Date: 2022-01-12T10:31:28-08:00
New Revision: 6e77ad11ffab71fa71629fe4df0af1ecefcfa649

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

LOG: Add an assert in cpudispatch emit to try to track down an error.

I'm attempting to debug an issue that I can only get to happen on
godbolt, where the cpu-dispatch resolver for an out of line member
function is generated with the wrong name, causing a link failure.

Added: 
    

Modified: 
    clang/lib/CodeGen/CodeGenModule.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 6d6f154f45bf8..d824cb3980506 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -3492,11 +3492,14 @@ void CodeGenModule::emitCPUDispatchDefinition(GlobalDecl GD) {
 
   llvm::Type *ResolverType;
   GlobalDecl ResolverGD;
-  if (getTarget().supportsIFunc())
+  if (getTarget().supportsIFunc()) {
     ResolverType = llvm::FunctionType::get(
         llvm::PointerType::get(DeclTy,
                                Context.getTargetAddressSpace(FD->getType())),
         false);
+    assert(ResolverName.endswith(".resolver") &&
+           "CPUDispatch IFunc resolver doesn't end with .resolver?");
+  }
   else {
     ResolverType = DeclTy;
     ResolverGD = GD;


        


More information about the cfe-commits mailing list