mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-10 02:25:47 +00:00
This code was trying too hard. By eliminating redundant edges in the CFG
due to switch cases going to the same place, it make #pred != #phi entries, breaking live interval analysis. This fixes 458.sjeng on x86 with llc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30236 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -970,24 +970,21 @@ void SelectionDAGLowering::visitSwitch(SwitchInst &I) {
|
|||||||
// of the jump table. If the value of the jump table slot corresponds to
|
// of the jump table. If the value of the jump table slot corresponds to
|
||||||
// a case statement, push the case's BB onto the vector, otherwise, push
|
// a case statement, push the case's BB onto the vector, otherwise, push
|
||||||
// the default BB.
|
// the default BB.
|
||||||
std::set<MachineBasicBlock*> UniqueBBs;
|
|
||||||
std::vector<MachineBasicBlock*> DestBBs;
|
std::vector<MachineBasicBlock*> DestBBs;
|
||||||
uint64_t TEI = First;
|
uint64_t TEI = First;
|
||||||
for (CaseItr ii = Cases.begin(), ee = Cases.end(); ii != ee; ++TEI) {
|
for (CaseItr ii = Cases.begin(), ee = Cases.end(); ii != ee; ++TEI) {
|
||||||
if (cast<ConstantIntegral>(ii->first)->getRawValue() == TEI) {
|
if (cast<ConstantIntegral>(ii->first)->getRawValue() == TEI) {
|
||||||
DestBBs.push_back(ii->second);
|
DestBBs.push_back(ii->second);
|
||||||
UniqueBBs.insert(ii->second);
|
|
||||||
++ii;
|
++ii;
|
||||||
} else {
|
} else {
|
||||||
DestBBs.push_back(Default);
|
DestBBs.push_back(Default);
|
||||||
UniqueBBs.insert(Default);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update successor info
|
// Update successor info
|
||||||
for (std::set<MachineBasicBlock*>::iterator ii = UniqueBBs.begin(),
|
for (std::vector<MachineBasicBlock*>::iterator I = DestBBs.begin(),
|
||||||
ee = UniqueBBs.end(); ii != ee; ++ii)
|
E = DestBBs.end(); I != E; ++I)
|
||||||
JumpTableBB->addSuccessor(*ii);
|
JumpTableBB->addSuccessor(*I);
|
||||||
|
|
||||||
// Create a jump table index for this jump table, or return an existing
|
// Create a jump table index for this jump table, or return an existing
|
||||||
// one.
|
// one.
|
||||||
|
Reference in New Issue
Block a user