[llvm] [TailDup][MachineSSAUpdater] Let RewriteUse insert a COPY when needed (PR #95553)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 19 09:25:42 PDT 2024


================
@@ -236,6 +236,19 @@ void MachineSSAUpdater::RewriteUse(MachineOperand &U) {
     NewVR = GetValueInMiddleOfBlock(UseMI->getParent());
   }
 
+  // Insert a COPY if register class contraint isn't fulfilled.
+  if (const TargetRegisterClass *RC =
+          dyn_cast_or_null<const TargetRegisterClass *>(RegAttrs.RCOrRB)) {
+    if (NewVR && !RC->hasSubClassEq(MRI->getRegClass(NewVR))) {
----------------
arsenm wrote:

Classes don't always follow a strict subset relationship. This will try to find one that works 

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


More information about the llvm-commits mailing list