OSDN Git Service

Fix switch lowering to order cases in zext order, which is how we emit the
authorChris Lattner <sabre@nondot.org>
Tue, 13 Feb 2007 01:05:56 +0000 (01:05 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 13 Feb 2007 01:05:56 +0000 (01:05 +0000)
comparisons.  This fixes an infinite loop on CodeGen/Generic/switch-lower.ll
and PR1197

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@34216 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp

index 16d25ee..0dd762e 100644 (file)
@@ -389,8 +389,8 @@ class SelectionDAGLowering {
   struct CaseCmp {
     bool operator () (const Case& C1, const Case& C2) {
       assert(isa<ConstantInt>(C1.first) && isa<ConstantInt>(C2.first));
-      return cast<const ConstantInt>(C1.first)->getSExtValue() <
-        cast<const ConstantInt>(C2.first)->getSExtValue();
+      return cast<const ConstantInt>(C1.first)->getZExtValue() <
+        cast<const ConstantInt>(C2.first)->getZExtValue();
     }
   };