[llvm] AMDGPU/GlobalISelDivergenceLowering: select divergent i1 phis (PR #80003)

Petar Avramovic via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 1 03:54:17 PST 2024


================
@@ -752,6 +752,17 @@ class MachineRegisterInfo {
   Register createVirtualRegister(const TargetRegisterClass *RegClass,
                                  StringRef Name = "");
 
+  /// All avilable attributes a virtual register can have.
+  struct RegisterAttributes {
----------------
petar-avramovic wrote:

> I'm not sure I understand why this is needed. It seems like it's just an additional helper to create a new register with a type + RC/RB all in one right?

Yes. 
"Attribute" was used to describe same thing for constrainRegAttrs in MachineRegisterInfo.h.
RegisterAttributes was defined here because it is also needed in MachineSSAUpdater. The struct was used because it  is better to pass around one struct then two arguments. And since struct is already available it was used in createVirtualRegister for LLT + RC/RB.

Bigger picture is that it is a nice abstraction that hides need to explicitly deal with LLT in SDAG path

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


More information about the llvm-commits mailing list