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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 18 04:54:35 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:

This should probably be using getCommonSubClass and checking if it's different from the original class 

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


More information about the llvm-commits mailing list