Skip to content

Fix opt crash in addVectorPasses when TargetMachine is null - #175

Merged
gmh5225 merged 1 commit into
devfrom
fix/opt-null-tm-addvectorpasses
Jul 24, 2026
Merged

Fix opt crash in addVectorPasses when TargetMachine is null#175
gmh5225 merged 1 commit into
devfrom
fix/opt-null-tm-addvectorpasses

Conversation

@gmh5225

@gmh5225 gmh5225 commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Null-check TM in PassBuilder::addVectorPasses before calling getTargetTriple(), matching the existing Windows guards at the call sites.
  • Prevents opt -passes=default<O1> from access-violating (0xC0000005) when no target triple / TargetMachine is available (e.g. empty IR input).

Closes #174

Test plan

  • echo '' | opt -passes='default<O1>' -disable-output should exit cleanly instead of crashing
  • With a Windows triple / TargetMachine present, vector passes remain disabled as before
  • With a non-Windows TargetMachine, vector passes still run

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

Null-check TM before querying the target triple so default pipelines
no longer AV when opt runs without a target (e.g. empty IR).

Closes #174
@gmh5225
gmh5225 merged commit 0285adc into dev Jul 24, 2026
21 checks passed
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.

[BUG] opt crashes (0xC0000005) in PassBuilder::addVectorPasses when no target triple is available

2 participants