[llvm] [TableGen][GISel] Create untyped registers during instruction selection (PR #121270)

Sergei Barannikov via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 6 03:14:12 PST 2025


s-barannikov wrote:

> > The type shouldn't matter for GlobalISel; registers created during instruction selection should be virtual (as opposed to generic).
> 
> Generic virtual registers are still virtual registers.

I wanted to make a distinction between virtual registers with and without a type. Probably not the best wording.
Virtual register with a type == generic register, virtual register without a type == ??

> computeKnownBits / simplifyDemandedBits will be able to understand a virtual register that still has a type but will give up on a value without one in a partially selected function.

This is a good point, I didn't consider these functions.
A couple of observations:
* A function is selected in RPO and basic blocks are selected bottom-up, so this analysis can discover an untyped register created this way only(?) through a phi node.
* Untyped registers are also created when constraining a virtual register results in inserting a `COPY`, see `llvm::constrainRegToClass` and its use in `constrainOperandRegClass`.


https://github.com/llvm/llvm-project/pull/121270


More information about the llvm-commits mailing list