[PATCH] D48154: [VirtRegRewriter] Avoid clobbering registers when expanding copy bundles

Matthias Braun via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 13 17:22:42 PDT 2018


MatzeB added inline comments.


================
Comment at: lib/CodeGen/VirtRegMap.cpp:428
+          continue;
+        const auto &SrcReg = Src->getOperand(1).getReg();
+        const auto &DstReg = Dst->getOperand(0).getReg();
----------------
`unsigned SrcReg` instead of `const auto&`?


================
Comment at: lib/CodeGen/VirtRegMap.cpp:430-433
+        for (MCRegUnitIterator SrcI(SrcReg, TRI); SrcI.isValid(); ++SrcI)
+          for (MCRegUnitIterator DstI(DstReg, TRI); DstI.isValid(); ++DstI)
+            if (*SrcI == *DstI)
+              return true;
----------------
Use `TargetRegisterInfo::regsOverlap()` for this.


================
Comment at: lib/CodeGen/VirtRegMap.cpp:456
+    MachineInstr *BundleStart = FirstMI;
+    for (auto *Inst : llvm::reverse(MIs)) {
+      // If instruction is in the middle of the bundle, move it before the
----------------
I'd vote for less `auto`, the type isn't immediately clear from this line.


https://reviews.llvm.org/D48154





More information about the llvm-commits mailing list