llvm / llvm/circt

[LLHD][ProcessLowering] Incorrectly inlines aliasing drives

Open
#7,665 7 comments 2 reactions 0 assignees View on GitHub
bug LLHD
Dominant language
C++
Stars
2.2k
Forks
524
Avg merge
3d 2h
Merged PRs (30d)
46

Description

The ProcessLowering pass checks whether an `llhd.process` operation is a combinational process and inlines it into the parent module if that's the case.

However, it doesn't check for aliasing drives. There can be a series of blocking drives where the first one does a general default assignment to the entire signal, and subsequent conditional drives, aliasing part of the signal, override parts. Since there is no fixed execution order inside modules, these must be combined before inlining. ProcessLowering should check for that and not perform the inlining in such cases.

The TemporalCodeMotion pass combines drives to the same signal to some degree but doesn't consider subelement aliasing. One option to support this is to perform SROA before TemporalCodeMotion.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading the ProcessLowering pass and the TemporalCodeMotion pass, focusing on how combinational processes and drives are handled. Determine how subelement aliasing affects drive combination. Done means aliasing drives are safely combined before inlining, or inlining is avoided when they cannot be combined, while unaffected processes retain their current behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.