diff options
author | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-07-20 21:03:45 +0000 |
---|---|---|
committer | Matt Arsenault <Matthew.Arsenault@amd.com> | 2017-07-20 21:03:45 +0000 |
commit | db78273b6ea5cdce18c768fce5a1bdf55d61d91d (patch) | |
tree | d4669ed5cfc8ff241e204644a9380ab6c68ccdab /llvm/lib/CodeGen/StackSlotColoring.cpp | |
parent | eac8e7c08abbe4c8adefcceb429bd073ef172622 (diff) | |
download | bcm5719-llvm-db78273b6ea5cdce18c768fce5a1bdf55d61d91d.tar.gz bcm5719-llvm-db78273b6ea5cdce18c768fce5a1bdf55d61d91d.zip |
Add an ID field to StackObjects
On AMDGPU SGPR spills are really spilled to another register.
The spiller creates the spills to new frame index objects,
which is used as a placeholder.
This will eventually be replaced with a reference to a position
in a VGPR to write to and the frame index deleted. It is
most likely not a real stack location that can be shared
with another stack object.
This is a problem when StackSlotColoring decides it should
combine a frame index used for a normal VGPR spill with
a real stack location and a frame index used for an SGPR.
Add an ID field so that StackSlotColoring has a way
of knowing the different frame index types are
incompatible.
llvm-svn: 308673
Diffstat (limited to 'llvm/lib/CodeGen/StackSlotColoring.cpp')
-rw-r--r-- | llvm/lib/CodeGen/StackSlotColoring.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/StackSlotColoring.cpp b/llvm/lib/CodeGen/StackSlotColoring.cpp index 856bca19dee..6bdff4fa2e2 100644 --- a/llvm/lib/CodeGen/StackSlotColoring.cpp +++ b/llvm/lib/CodeGen/StackSlotColoring.cpp @@ -233,6 +233,8 @@ StackSlotColoring::OverlapWithAssignments(LiveInterval *li, int Color) const { int StackSlotColoring::ColorSlot(LiveInterval *li) { int Color = -1; bool Share = false; + int FI = TargetRegisterInfo::stackSlot2Index(li->reg); + if (!DisableSharing) { // Check if it's possible to reuse any of the used colors. Color = UsedColors.find_first(); @@ -246,6 +248,11 @@ int StackSlotColoring::ColorSlot(LiveInterval *li) { } } + if (Color != -1 && MFI->getStackID(Color) != MFI->getStackID(FI)) { + DEBUG(dbgs() << "cannot share FIs with different stack IDs\n"); + Share = false; + } + // Assign it to the first available color (assumed to be the best) if it's // not possible to share a used color with other objects. if (!Share) { @@ -257,7 +264,6 @@ int StackSlotColoring::ColorSlot(LiveInterval *li) { // Record the assignment. Assignments[Color].push_back(li); - int FI = TargetRegisterInfo::stackSlot2Index(li->reg); DEBUG(dbgs() << "Assigning fi#" << FI << " to fi#" << Color << "\n"); // Change size and alignment of the allocated slot. If there are multiple |