[PATCH] D149146: [TailDuplicator] Don't constrain register classes due to debug instructions

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 25 22:34:32 PDT 2023


uabelho added inline comments.


================
Comment at: llvm/lib/CodeGen/TailDuplicator.cpp:434
+            // rather than constraining the register class further.
+            if (!NewMI.isDebugInstr())
+              ConstrRC = MRI->constrainRegClass(VI->second.Reg, OrigRC);
----------------
arsenm wrote:
> uabelho wrote:
> > foad wrote:
> > > Just a cosmetic thing, I'd prefer you swap the "if" and "else" cases so you don't have an "else" after an already negated condition.
> > Sure, done!
> ConstRC = isDebug ? MappedRC : MRI->constrain()?
> 
> Could you also just initialize ConstRC with MappedRC above?
I guess initializing
           const TargetRegisterClass *ConstrRC = Mapped;
plus then doing
            if (!NewMI.isDebugInstr())
              ConstRC = MRI->constrainRegClass(VI->second.Reg, OrigRC);
would be the same thing.

I think I prefer just 
            ConstrRC = NewMI.isDebugInstr()
                           ? MappedRC
                           : MRI->constrainRegClass(VI->second.Reg, OrigRC);
though so I'll update the patch with that.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149146/new/

https://reviews.llvm.org/D149146



More information about the llvm-commits mailing list