diff options
| author | Chris Lattner <sabre@nondot.org> | 2004-05-10 05:12:43 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2004-05-10 05:12:43 +0000 |
| commit | 6d3848df7e1f2d773ed7ae1a225944810d8510ad (patch) | |
| tree | c9dd629bf51651331abe72bd71a544504ce16639 /lib/CodeGen/LiveVariables.cpp | |
| parent | 02eac3935949b572439c799a5a8ac334d581b42c (diff) | |
Patch to fix PR337. Make sure to mark all aliased physical registers as used
when we see a read of a register. This is important in cases like:
AL = ...
AH = ...
= AX
The read of AX must make both the AL and AH defs live until the use.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13444 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/LiveVariables.cpp')
| -rw-r--r-- | lib/CodeGen/LiveVariables.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/lib/CodeGen/LiveVariables.cpp b/lib/CodeGen/LiveVariables.cpp index 759a0b3412..f1a7d9eb0f 100644 --- a/lib/CodeGen/LiveVariables.cpp +++ b/lib/CodeGen/LiveVariables.cpp @@ -126,6 +126,12 @@ void LiveVariables::HandleVirtRegUse(VarInfo &VRInfo, MachineBasicBlock *MBB, void LiveVariables::HandlePhysRegUse(unsigned Reg, MachineInstr *MI) { PhysRegInfo[Reg] = MI; PhysRegUsed[Reg] = true; + + for (const unsigned *AliasSet = RegInfo->getAliasSet(Reg); + unsigned Alias = *AliasSet; ++AliasSet) { + PhysRegInfo[Alias] = MI; + PhysRegUsed[Alias] = true; + } } void LiveVariables::HandlePhysRegDef(unsigned Reg, MachineInstr *MI) { @@ -140,11 +146,10 @@ void LiveVariables::HandlePhysRegDef(unsigned Reg, MachineInstr *MI) { PhysRegUsed[Reg] = false; for (const unsigned *AliasSet = RegInfo->getAliasSet(Reg); - *AliasSet; ++AliasSet) { - unsigned Alias = *AliasSet; + unsigned Alias = *AliasSet; ++AliasSet) { if (MachineInstr *LastUse = PhysRegInfo[Alias]) { if (PhysRegUsed[Alias]) - RegistersKilled.insert(std::make_pair(LastUse, Alias)); + RegistersKilled.insert(std::make_pair(LastUse, Alias)); else RegistersDead.insert(std::make_pair(LastUse, Alias)); } |
