[PATCH] D32650: Properly handle PHIs with subregisters in UnreachableBlockElim

Krzysztof Parzyszek via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 28 11:22:32 PDT 2017


kparzysz marked 3 inline comments as done.
kparzysz added inline comments.


================
Comment at: lib/CodeGen/UnreachableBlockElim.cpp:213-221
+            // The input register to the PHI has a subregister:
+            // create a new register and insert a COPY instead.
+            const TargetRegisterClass *OutRC = MRI.getRegClass(OutputReg);
+            unsigned NewOutput = MRI.createVirtualRegister(OutRC);
+            const TargetInstrInfo *TII = F.getSubtarget().getInstrInfo();
+            BuildMI(*BB, BB->getFirstNonPHI(), phi->getDebugLoc(),
+                    TII->get(TargetOpcode::COPY), NewOutput)
----------------
MatzeB wrote:
> Why go through the trouble of creating a new output register? You should be able to reuse "OutputReg" and not do any `replaceRegWith` operation.
Ha, indeed.


Repository:
  rL LLVM

https://reviews.llvm.org/D32650





More information about the llvm-commits mailing list