[llvm-commits] [llvm] r112876 - /llvm/trunk/lib/Analysis/LazyValueInfo.cpp

Owen Anderson resistor at mac.com
Thu Sep 2 15:16:52 PDT 2010


Author: resistor
Date: Thu Sep  2 17:16:52 2010
New Revision: 112876

URL: http://llvm.org/viewvc/llvm-project?rev=112876&view=rev
Log:
Remove incorrect and poorly tested code for trying to reason about values on default edges of
switches.  Just return the conservatively correct answer.

Modified:
    llvm/trunk/lib/Analysis/LazyValueInfo.cpp

Modified: llvm/trunk/lib/Analysis/LazyValueInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LazyValueInfo.cpp?rev=112876&r1=112875&r2=112876&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LazyValueInfo.cpp (original)
+++ llvm/trunk/lib/Analysis/LazyValueInfo.cpp Thu Sep  2 17:16:52 2010
@@ -670,25 +670,11 @@
   // If the edge was formed by a switch on the value, then we may know exactly
   // what it is.
   if (SwitchInst *SI = dyn_cast<SwitchInst>(BBFrom->getTerminator())) {
-    // If BBTo is the default destination of the switch, we know that it 
-    // doesn't have the same value as any of the cases.
     if (SI->getCondition() == Val) {
+      // We don't know anything in the default case.
       if (SI->getDefaultDest() == BBTo) {
-        const IntegerType *IT = cast<IntegerType>(Val->getType());
-        ConstantRange CR(IT->getBitWidth());
-        
-        for (unsigned i = 1, e = SI->getNumSuccessors(); i != e; ++i) {
-          const APInt CaseVal = SI->getCaseValue(i)->getValue();
-          ConstantRange CaseRange(CaseVal, CaseVal+1);
-          CaseRange = CaseRange.inverse();
-          CR = CR.intersectWith(CaseRange);
-        }
-        
         LVILatticeVal Result;
-        if (CR.isFullSet() || CR.isEmptySet())
-          Result.markOverdefined();
-        else
-          Result.markConstantRange(CR);
+        Result.markOverdefined();
         return Result;
       }
       





More information about the llvm-commits mailing list