[llvm-commits] CVS: llvm/lib/Transforms/Utils/LowerSwitch.cpp

Reid Spencer reid at x10sys.com
Fri Mar 2 15:05:45 PST 2007



Changes in directory llvm/lib/Transforms/Utils:

LowerSwitch.cpp updated: 1.32 -> 1.33
---
Log message:

1. Sort switch cases using APInt safe comparison.
2. Make sure debug output of APInt values is safe for all bit widths.


---
Diffs of the changes:  (+2 -2)

 LowerSwitch.cpp |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


Index: llvm/lib/Transforms/Utils/LowerSwitch.cpp
diff -u llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.32 llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.33
--- llvm/lib/Transforms/Utils/LowerSwitch.cpp:1.32	Sat Dec 30 23:48:39 2006
+++ llvm/lib/Transforms/Utils/LowerSwitch.cpp	Fri Mar  2 17:05:28 2007
@@ -59,7 +59,7 @@
 
       const ConstantInt* CI1 = cast<const ConstantInt>(C1.first);
       const ConstantInt* CI2 = cast<const ConstantInt>(C2.first);
-      return CI1->getZExtValue() < CI2->getZExtValue();
+      return CI1->getValue().ult(CI2->getValue());
     }
   };
 
@@ -128,7 +128,7 @@
 
   Case& Pivot = *(Begin + Mid);
   DOUT << "Pivot ==> "
-       << cast<ConstantInt>(Pivot.first)->getSExtValue() << "\n";
+       << cast<ConstantInt>(Pivot.first)->getValue().toStringSigned(10) << "\n";
 
   BasicBlock* LBranch = switchConvert(LHS.begin(), LHS.end(), Val,
                                       OrigBlock, Default);






More information about the llvm-commits mailing list