[llvm-commits] [llvm] r108118 - /llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp
Lang Hames
lhames at gmail.com
Sun Jul 18 02:09:50 PDT 2010
> I think that the test for virtual registers is more strict than it needs
to be,
> it should be possible to coalesce two virtual registers the class of one
> is a subclass of the other.
That certainly sounds safe if the destination class is a subclass of the
source class. I assume going the other way is dangerous, in that it could
leave junk in the non-aliased portion of the super-register?
Cheers,
Lang.
On Mon, Jul 12, 2010 at 11:45 AM, Rafael Espindola <
rafael.espindola at gmail.com> wrote:
> Author: rafael
> Date: Sun Jul 11 20:45:38 2010
> New Revision: 108118
>
> URL: http://llvm.org/viewvc/llvm-project?rev=108118&view=rev
> Log:
> Don't use getPhysicalRegisterRegClass in PBQP. The existing checks that the
> physical register can be allocated in the class of the virtual are
> sufficient.
>
> I think that the test for virtual registers is more strict than it needs to
> be,
> it should be possible to coalesce two virtual registers the class of one
> is a subclass of the other.
>
> Modified:
> llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp
>
> Modified: llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp?rev=108118&r1=108117&r2=108118&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp (original)
> +++ llvm/trunk/lib/CodeGen/RegAllocPBQP.cpp Sun Jul 11 20:45:38 2010
> @@ -396,28 +396,23 @@
> if (srcRegIsPhysical && dstRegIsPhysical)
> continue;
>
> - // If it's a copy that includes a virtual register but the source
> and
> - // destination classes differ then we can't coalesce, so continue
> with
> - // the next instruction.
> - const TargetRegisterClass *srcRegClass = srcRegIsPhysical ?
> - tri->getPhysicalRegisterRegClass(srcReg) :
> mri->getRegClass(srcReg);
> -
> - const TargetRegisterClass *dstRegClass = dstRegIsPhysical ?
> - tri->getPhysicalRegisterRegClass(dstReg) :
> mri->getRegClass(dstReg);
> -
> - if (srcRegClass != dstRegClass)
> + // If it's a copy that includes two virtual register but the source
> and
> + // destination classes differ then we can't coalesce.
> + if (!srcRegIsPhysical && !dstRegIsPhysical &&
> + mri->getRegClass(srcReg) != mri->getRegClass(dstReg))
> continue;
>
> - // We also need any physical regs to be allocable, coalescing with
> - // a non-allocable register is invalid.
> - if (srcRegIsPhysical) {
> + // If one is physical and one is virtual, check that the physical is
> + // allocatable in the class of the virtual.
> + if (srcRegIsPhysical && !dstRegIsPhysical) {
> + const TargetRegisterClass *dstRegClass = mri->getRegClass(dstReg);
> if (std::find(dstRegClass->allocation_order_begin(*mf),
> dstRegClass->allocation_order_end(*mf), srcReg) ==
> dstRegClass->allocation_order_end(*mf))
> continue;
> }
> -
> - if (dstRegIsPhysical) {
> + if (!srcRegIsPhysical && dstRegIsPhysical) {
> + const TargetRegisterClass *srcRegClass = mri->getRegClass(srcReg);
> if (std::find(srcRegClass->allocation_order_begin(*mf),
> srcRegClass->allocation_order_end(*mf), dstReg) ==
> srcRegClass->allocation_order_end(*mf))
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20100718/b011cd4f/attachment.html>
More information about the llvm-commits
mailing list