Skip to content

Static functions cause issues in debug builds #1711

Description

Hello,
I am getting crashes with dead code ellimination and i was trying to find the issue, but very often in debug builds i get this annoying assert

assert(isInstance() && "No 'this' for static methods!");

Seems to me a little off.
Here is the callstack

 	dxcompiler.dll!llvm_assert(const char * _Message, const char * _File, unsigned int _Line, const char * _Function) Line 23	C++
>	dxcompiler.dll!clang::CXXMethodDecl::getThisType(clang::ASTContext & C) Line 1601	C++
 	dxcompiler.dll!`anonymous namespace'::CGMSHLSLRuntime::AddHLSLFunctionInfo(llvm::Function * F, const clang::FunctionDecl * FD) Line 1550	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenModule::SetLLVMFunctionAttributes(const clang::Decl * D, const clang::CodeGen::CGFunctionInfo & Info, llvm::Function * F) Line 764	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenModule::SetFunctionAttributes(clang::GlobalDecl GD, llvm::Function * F, bool IsIncompleteFunction, bool IsThunk) Line 951	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenModule::GetOrCreateLLVMFunction(llvm::StringRef MangledName, llvm::Type * Ty, clang::GlobalDecl GD, bool ForVTable, bool DontDefer, bool IsThunk, llvm::AttributeSet ExtraAttrs) Line 1655	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenModule::GetAddrOfFunction(clang::GlobalDecl GD, llvm::Type * Ty, bool ForVTable, bool DontDefer) Line 1731	C++
 	dxcompiler.dll!EmitFunctionDeclLValue(clang::CodeGen::CodeGenFunction & CGF, const clang::Expr * E, const clang::FunctionDecl * FD) Line 2021	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenFunction::EmitDeclRefLValue(const clang::DeclRefExpr * E) Line 2186	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenFunction::EmitLValue(const clang::Expr * E) Line 862	C++
 	dxcompiler.dll!`anonymous namespace'::ScalarExprEmitter::EmitLValue(const clang::Expr * E) Line 85	C++
 	dxcompiler.dll!`anonymous namespace'::ScalarExprEmitter::VisitCastExpr(clang::CastExpr * CE) Line 1637	C++
 	dxcompiler.dll!clang::StmtVisitorBase<clang::make_ptr,`anonymous namespace'::ScalarExprEmitter,llvm::Value *>::VisitImplicitCastExpr(clang::ImplicitCastExpr * S) Line 399	C++
 	dxcompiler.dll!clang::StmtVisitorBase<clang::make_ptr,`anonymous namespace'::ScalarExprEmitter,llvm::Value *>::Visit(clang::Stmt * S) Line 399	C++
 	dxcompiler.dll!`anonymous namespace'::ScalarExprEmitter::Visit(clang::Expr * E) Line 228	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenFunction::EmitScalarExpr(const clang::Expr * E, bool IgnoreResultAssign) Line 3859	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenFunction::EmitCallExpr(const clang::CallExpr * E, clang::CodeGen::ReturnValueSlot ReturnValue) Line 3619	C++
 	dxcompiler.dll!`anonymous namespace'::ScalarExprEmitter::VisitCallExpr(const clang::CallExpr * E) Line 363	C++
 	dxcompiler.dll!clang::StmtVisitorBase<clang::make_ptr,`anonymous namespace'::ScalarExprEmitter,llvm::Value *>::Visit(clang::Stmt * S) Line 305	C++
 	dxcompiler.dll!`anonymous namespace'::ScalarExprEmitter::Visit(clang::Expr * E) Line 228	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenFunction::EmitScalarExpr(const clang::Expr * E, bool IgnoreResultAssign) Line 3859	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenFunction::EmitAnyExpr(const clang::Expr * E, clang::CodeGen::AggValueSlot aggSlot, bool ignoreResult) Line 125	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(const clang::Expr * E) Line 110	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenFunction::EmitStmt(const clang::Stmt * S) Line 107	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(const clang::CompoundStmt & S, bool GetLast, clang::CodeGen::AggValueSlot AggSlot) Line 304	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenFunction::EmitCompoundStmt(const clang::CompoundStmt & S, bool GetLast, clang::CodeGen::AggValueSlot AggSlot) Line 294	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenFunction::EmitSimpleStmt(const clang::Stmt * S) Line 262	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenFunction::EmitStmt(const clang::Stmt * S) Line 51	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenFunction::EmitForStmt(const clang::ForStmt & S, llvm::ArrayRef<clang::Attr const *> ForAttrs) Line 959	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenFunction::EmitStmt(const clang::Stmt * S) Line 135	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(const clang::CompoundStmt & S, bool GetLast, clang::CodeGen::AggValueSlot AggSlot) Line 304	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList & Args, const clang::Stmt * Body) Line 807	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl GD, llvm::Function * Fn, const clang::CodeGen::CGFunctionInfo & FnInfo) Line 934	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl GD, llvm::GlobalValue * GV) Line 2605	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl GD, llvm::GlobalValue * GV) Line 1591	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenModule::EmitDeferred() Line 1184	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenModule::EmitDeferred() Line 1186	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenModule::EmitDeferred() Line 1186	C++
 	dxcompiler.dll!clang::CodeGen::CodeGenModule::Release() Line 385	C++
 	dxcompiler.dll!`anonymous namespace'::CodeGeneratorImpl::HandleTranslationUnit(clang::ASTContext & Ctx) Line 216	C++
 	dxcompiler.dll!clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext & C) Line 148	C++
 	dxcompiler.dll!clang::ParseAST(clang::Sema & S, bool PrintStats, bool SkipFunctionBodies) Line 162	C++
 	dxcompiler.dll!clang::ASTFrontendAction::ExecuteAction() Line 556	C++
 	dxcompiler.dll!clang::CodeGenAction::ExecuteAction() Line 755	C++
 	dxcompiler.dll!clang::FrontendAction::Execute() Line 468	C++
 	dxcompiler.dll!DxcCompiler::CompileWithDebug(IDxcBlob * pSource, const wchar_t * pSourceName, const wchar_t * pEntryPoint, const wchar_t * pTargetProfile, const wchar_t * * pArguments, unsigned int argCount, const DxcDefine * pDefines, unsigned int defineCount, IDxcIncludeHandler * pIncludeHandler, IDxcOperationResult * * ppResult, wchar_t * * ppDebugBlobName, IDxcBlob * * ppDebugBlob) Line 552	C++
 	dxcompiler.dll!DxcCompiler::Compile(IDxcBlob * pSource, const wchar_t * pSourceName, const wchar_t * pEntryPoint, const wchar_t * pTargetProfile, const wchar_t * * pArguments, unsigned int argCount, const DxcDefine * pDefines, unsigned int defineCount, IDxcIncludeHandler * pIncludeHandler, IDxcOperationResult * * ppResult) Line 300	C++

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions