Browse Source

Call FixOverloadNames before RefreshCache to prevent more linking problems (#3113)

Tex Riddell 5 years ago
parent
commit
8ea4f7947a
1 changed files with 9 additions and 0 deletions
  1. 9 0
      lib/DXIL/DxilOperations.cpp

+ 9 - 0
lib/DXIL/DxilOperations.cpp

@@ -909,6 +909,15 @@ OP::OP(LLVMContext &Ctx, Module *pModule)
 
   Type *Int4Types[4] = { Type::getInt32Ty(m_Ctx), Type::getInt32Ty(m_Ctx), Type::getInt32Ty(m_Ctx), Type::getInt32Ty(m_Ctx) }; // HiHi, HiLo, LoHi, LoLo
   m_pInt4Type = GetOrCreateStructType(m_Ctx, Int4Types, "dx.types.fouri32", pModule);
+
+  // When loading a module into an existing context where types are merged,
+  // type names may change.  When this happens, any intrinsics overloaded on
+  // UDT types will no longer have matching overload names.
+  // This causes RefreshCache() to assert.
+  // This fixes the function names to they match the expected types,
+  // preventing RefreshCache() from failing due to this issue.
+  FixOverloadNames();
+
   // Try to find existing intrinsic function.
   RefreshCache();
 }