When performing return slot optimization, remember to inform memdep when we're removi...
[oota-llvm.git] / lib / Transforms / Scalar / PredicateSimplifier.cpp
index 8b4ed73e47f6c5661af0c3ef2b9de4dc05306da9..388071d1e9ac5bb33f7ed7f31b8c44f0c8dd4350 100644 (file)
@@ -2,8 +2,8 @@
 //
 //                     The LLVM Compiler Infrastructure
 //
-// This file was developed by Nick Lewycky and is distributed under the
-// University of Illinois Open Source License. See LICENSE.TXT for details.
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
 //
 //===----------------------------------------------------------------------===//
 //
@@ -1120,11 +1120,8 @@ namespace {
     uint32_t typeToWidth(const Type *Ty) const {
       if (TD)
         return TD->getTypeSizeInBits(Ty);
-
-      if (const IntegerType *ITy = dyn_cast<IntegerType>(Ty))
-        return ITy->getBitWidth();
-
-      return 0;
+      else
+        return Ty->getPrimitiveSizeInBits();
     }
 
     static bool isRelatedBy(const ConstantRange &CR1, const ConstantRange &CR2,
@@ -2001,7 +1998,7 @@ namespace {
               if (!isRelatedBy(Known, Zero, ICmpInst::ICMP_NE)) break;
               // otherwise, fall-through.
             case Instruction::Sub:
-              if (Unknown == Op1) break;
+              if (Unknown == Op0) break;
               // otherwise, fall-through.
             case Instruction::Xor:
             case Instruction::Add: