From 368ddbb7b99dfb939d20f53c35d05b2b4758bd64 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Mon, 21 Jul 2025 09:30:24 -0700 Subject: Add utility to trace creation of problematic IRInsts to assist LLM in debugging (#7820) * Initial plan * Add SLANG_DEBUG_IR_BREAK environment variable support Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Apply code formatting to SLANG_DEBUG_IR_BREAK implementation Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Improve stack trace debugging with -rdynamic flag and backtrace_symbols Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Address PR feedback: use PlatformUtil::getEnvironmentVariable, remove -rdynamic flag, and delete fallback branch Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Address PR feedback: simplify env var parsing, move backtrace to PlatformUtil, use #if for SLANG_LINUX_FAMILY Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Address PR feedback: remove unneeded include, make backtrace() more generic by removing uid parameter Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * Fix and clone source tracking. * Add python script to dump traces. * Update instructions. * Batch calls to addr2line * Cleanup claude instructions. * update claude action. * Remove duplicated build instructions from claude.yml workflow Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> * fix build error. * Fix build errors --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: csyonghe <2652293+csyonghe@users.noreply.github.com> Co-authored-by: Yong He Co-authored-by: Gangzheng Tong --- source/slang/slang-ir-link.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source/slang/slang-ir-link.cpp') diff --git a/source/slang/slang-ir-link.cpp b/source/slang/slang-ir-link.cpp index b874b9f28..a3466c8c7 100644 --- a/source/slang/slang-ir-link.cpp +++ b/source/slang/slang-ir-link.cpp @@ -1332,6 +1332,11 @@ IRInst* cloneInst( IRInst* originalInst, IROriginalValuesForClone const& originalValues) { +#if SLANG_ENABLE_IR_BREAK_ALLOC + _debugSetInstBeingCloned(originalInst->_debugUID); + SLANG_DEFER(_debugResetInstBeingCloned()); +#endif + switch (originalInst->getOp()) { // We need to special-case any instruction that is not @@ -1427,7 +1432,6 @@ IRInst* cloneInst( } auto funcType = cloneType(context, originalInst->getFullType()); context->builder = oldBuilder; - IRInst* clonedInst = builder->createIntrinsicInst( funcType, originalInst->getOp(), -- cgit v1.2.3