Skip to content

50 self analysis remove remaining false positive and make warnings only output actionable#51

Merged
SizzleUnrlsd merged 26 commits intomainfrom
50-self-analysis-remove-remaining-false-positive-and-make---warnings-only-output-actionable
Feb 26, 2026
Merged

50 self analysis remove remaining false positive and make warnings only output actionable#51
SizzleUnrlsd merged 26 commits intomainfrom
50-self-analysis-remove-remaining-false-positive-and-make---warnings-only-output-actionable

Conversation

@SizzleUnrlsd
Copy link
Contributor

Description

This PR improves self-analysis signal quality and warning triage UX.

Changes included:

  • AnalyzerApp human output now applies warning filtering first, then keeps only functions linked to remaining diagnostics in --warnings-only mode.
  • Removed redundant conditional return in stripIntCasts(...):
    • return Cur ? Cur : V; -> return Cur;
    • This eliminates the false positive duplicate-condition diagnostic.
  • Added regression fixture for --warnings-only function filtering.
  • Updated run_test.py checks to validate the new behavior and keep existing regression coverage stable.

Architecture rationale:

  • Filtering is implemented in the presentation/output layer (CLI rendering), not in core dataflow/analysis logic, to avoid changing analysis semantics and future detection behavior.

Validation:

  • cmake --build build --target stack_usage_analyzer -j4
  • ./run_test.py --jobs=4 passed (414/414)
  • Targeted self-analysis check confirms no warning remains on stripIntCasts(...).

static const llvm::DIType* getAllocaDebugDeclaredType(const llvm::AllocaInst& AI)
{
auto* nonConstAI = const_cast<llvm::AllocaInst*>(&AI);
for (llvm::DbgDeclareInst* ddi : llvm::findDbgDeclares(nonConstAI))

Check warning

Code scanning / coretrace-stack-analyzer

ResourceLifetime.IncompleteInterproc Warning

[ !!Warn ] inter-procedural resource analysis incomplete: handle 'ref.tmp' may be acquired by an unmodeled/external callee before release ↳ no matching resource model rule or cross-TU summary was found for at least one related call ↳ include callee definitions in inputs or extend --resource-model to improve precision
return var->getType();
}

for (llvm::DbgVariableRecord* dvr : llvm::findDVRDeclares(nonConstAI))

Check warning

Code scanning / coretrace-stack-analyzer

ResourceLifetime.IncompleteInterproc Warning

[ !!Warn ] inter-procedural resource analysis incomplete: handle 'ref.tmp12' may be acquired by an unmodeled/external callee before release ↳ no matching resource model rule or cross-TU summary was found for at least one related call ↳ include callee definitions in inputs or extend --resource-model to improve precision

llvm::SmallPtrSet<const llvm::Metadata*, 16> visitedTypes;
return !debugTypeHasDataMembers(declaredType, 0, visitedTypes);
}

Check warning

Code scanning / coretrace-stack-analyzer

ResourceLifetime.IncompleteInterproc Warning

[ !!Warn ] inter-procedural resource analysis incomplete: handle 'visitedTypes' may be acquired by an unmodeled/external callee before release ↳ no matching resource model rule or cross-TU summary was found for at least one related call ↳ include callee definitions in inputs or extend --resource-model to improve precision
return true;
}
out.clear();
}

Check warning

Code scanning / coretrace-stack-analyzer

ResourceLifetime.IncompleteInterproc Warning

[ !!Warn ] inter-procedural resource analysis incomplete: handle 'visiting' may be acquired by an unmodeled/external callee before release ↳ no matching resource model rule or cross-TU summary was found for at least one related call ↳ include callee definitions in inputs or extend --resource-model to improve precision
{
using namespace llvm;

if (!currentType || !sourceElementType || depth > 12)

Check notice

Code scanning / coretrace-stack-analyzer

None Note

[ !Info! ] recursive or mutually recursive function detected
static void collectVTableEntries(const llvm::Constant* node,
std::vector<const llvm::Constant*>& out)
{
if (!node)

Check notice

Code scanning / coretrace-stack-analyzer

None Note

[ !Info! ] recursive or mutually recursive function detected
debugTypeHasDataMembers(const llvm::DIType* type, unsigned depth,
llvm::SmallPtrSetImpl<const llvm::Metadata*>& visitedTypes)
{
if (!type || depth > 12)

Check notice

Code scanning / coretrace-stack-analyzer

None Note

[ !Info! ] recursive or mutually recursive function detected
std::uint64_t baseOffset, unsigned depth,
RangeSet& out)
{
if (!ty || depth > 12)

Check notice

Code scanning / coretrace-stack-analyzer

None Note

[ !Info! ] recursive or mutually recursive function detected
const llvm::DIType* type, std::uint64_t baseOffsetBits, unsigned depth,
llvm::SmallPtrSetImpl<const llvm::Metadata*>& visiting, RangeSet& out)
{
if (!type || depth > 16)

Check notice

Code scanning / coretrace-stack-analyzer

None Note

[ !Info! ] recursive or mutually recursive function detected
@SizzleUnrlsd SizzleUnrlsd merged commit 8800260 into main Feb 26, 2026
10 checks passed
@SizzleUnrlsd SizzleUnrlsd deleted the 50-self-analysis-remove-remaining-false-positive-and-make---warnings-only-output-actionable branch February 26, 2026 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Self-analysis: remove remaining false positive and make --warnings-only output actionable

1 participant