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

Björn Pettersson via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 20 00:19:05 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))) {
----------------
bjope wrote:

Ok. Now when using `constrainRegClass ` instead I think this part should be fine then. Since that one is using `getCommonSubClass` internally.

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


More information about the llvm-commits mailing list