llvm / llvm/circt

[FIRRTL][DropConst] Preserve alias?

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

Description

Consider:
```
FIRRTL version 4.0.0

circuit ConstAlias:
type X = { a: const UInt<1> }
public module ConstAlias:
input x : X
output y : X
connect y, x
```

Run like:
`firtool const_alias.fir -preserve-aggregate=all --scalarize-public-modules=false`

Dropping "const" from the example above (modify the FIRRTL's text) and the type alias makes it to the output.

Arguably the type name shouldn't be preserved if mutating it (dropping const), but since that's unrepresentable thereafter (as well as in the lowered/output) there seems to be a reasonable case for keeping the type alias but without the const bits.

Low-priority as I don't think `const` is used but FYI.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the example with FIRRTL 4.0.0 using the provided firtool command and compare output with and without the const qualifier. Start by tracing the FIRRTL DropConst handling for the ConstAlias type; done means the alias is preserved without const bits, or the intended behavior is documented if it cannot be preserved.

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
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.