[llvm-commits] CVS: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
Chris Lattner
sabre at nondot.org
Tue Feb 13 23:18:32 PST 2007
Changes in directory llvm/lib/CodeGen/SelectionDAG:
SelectionDAGISel.cpp updated: 1.365 -> 1.366
---
Log message:
Refix CodeGen/Generic/switch-lower.ll. In contrast to my previous patch,
this doesn't miscompile lots of programs :)
---
Diffs of the changes: (+5 -5)
SelectionDAGISel.cpp | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
Index: llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
diff -u llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.365 llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.366
--- llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1.365 Tue Feb 13 23:52:17 2007
+++ llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp Wed Feb 14 01:18:16 2007
@@ -1205,8 +1205,8 @@
if ((TLI.isOperationLegal(ISD::BR_JT, MVT::Other) ||
TLI.isOperationLegal(ISD::BRIND, MVT::Other)) &&
Cases.size() > 5) {
- uint64_t First =cast<ConstantInt>(Cases.front().first)->getZExtValue();
- uint64_t Last = cast<ConstantInt>(Cases.back().first)->getZExtValue();
+ uint64_t First =cast<ConstantInt>(Cases.front().first)->getSExtValue();
+ uint64_t Last = cast<ConstantInt>(Cases.back().first)->getSExtValue();
double Density = (double)Cases.size() / (double)((Last - First) + 1ULL);
if (Density >= 0.3125) {
@@ -1255,7 +1255,7 @@
std::vector<MachineBasicBlock*> DestBBs;
uint64_t TEI = First;
for (CaseItr ii = Cases.begin(), ee = Cases.end(); ii != ee; ++TEI)
- if (cast<ConstantInt>(ii->first)->getZExtValue() == TEI) {
+ if (cast<ConstantInt>(ii->first)->getSExtValue() == TEI) {
DestBBs.push_back(ii->second);
++ii;
} else {
@@ -1363,8 +1363,8 @@
// Create a CaseBlock record representing a conditional branch to
// the LHS node if the value being switched on SV is less than C.
// Otherwise, branch to LHS.
- ISD::CondCode CC = ISD::SETLT;
- SelectionDAGISel::CaseBlock CB(CC, SV, C, TrueBB, FalseBB, CR.CaseBB);
+ SelectionDAGISel::CaseBlock CB(ISD::SETLT, SV, C, TrueBB, FalseBB,
+ CR.CaseBB);
if (CR.CaseBB == CurMBB)
visitSwitchCase(CB);
More information about the llvm-commits
mailing list