Skip to content

Fixed HLMatrixLower not copying over debug location to dbg.delcare#4544

Merged
adam-yang merged 2 commits intomicrosoft:mainfrom
adam-yang:hl_matrix_dbg_declare_loc
Jul 9, 2022
Merged

Fixed HLMatrixLower not copying over debug location to dbg.delcare#4544
adam-yang merged 2 commits intomicrosoft:mainfrom
adam-yang:hl_matrix_dbg_declare_loc

Conversation

@adam-yang
Copy link
Copy Markdown
Contributor

Fixes #4536

@adam-yang adam-yang requested a review from pow2clk July 7, 2022 23:05
@AppVeyorBot
Copy link
Copy Markdown

Copy link
Copy Markdown

@phlogios phlogios left a comment

Choose a reason for hiding this comment

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

This solves our bug. Thanks!

Comment thread lib/HLSL/HLMatrixLowerPass.cpp Outdated
Value *ValueMetadata = MetadataAsValue::get(Context, ValueAsMetadata::get(LoweredAlloca));
IRBuilder<> DebugBuilder(DbgDeclare);
DebugBuilder.CreateCall(DbgDeclare->getCalledFunction(), { ValueMetadata, DbgDeclareVar, DbgDeclareExpr });
CallInst *CI = DebugBuilder.CreateCall(DbgDeclare->getCalledFunction(), { ValueMetadata, DbgDeclareVar, DbgDeclareExpr });
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there other place need this change?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I didn't see anything else. The whole problem was using IRBuilder, which didn't enforce debug location.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a change to use DIBuilder instead.

@AppVeyorBot
Copy link
Copy Markdown

Copy link
Copy Markdown
Collaborator

@pow2clk pow2clk left a comment

Choose a reason for hiding this comment

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

Looks good!

@adam-yang adam-yang merged commit c93453a into microsoft:main Jul 9, 2022
adam-yang added a commit to adam-yang/DirectXShaderCompiler that referenced this pull request Jul 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[DXIL] Compiler crashes when using optimizations and -Zi on a complex HLSL shader

5 participants