Remove unnecessary dyn_cast and add a comment. Part of a WIP.
authorEric Christopher <echristo@apple.com>
Fri, 8 Jan 2010 21:37:11 +0000 (21:37 +0000)
committerEric Christopher <echristo@apple.com>
Fri, 8 Jan 2010 21:37:11 +0000 (21:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93026 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/InstCombine/InstCombineCalls.cpp

index e34360087c645ed6e6e1c3630454a048d1ea3cb5..47c37c46587d4fd0634154fcf7c5d06c770bbad1 100644 (file)
@@ -633,12 +633,12 @@ Instruction *InstCombiner::visitCallInst(CallInst &CI) {
     break;
   }
   case Intrinsic::objectsize: {
-    ConstantInt *Const = dyn_cast<ConstantInt>(II->getOperand(2));
-
-    if (!Const) return 0;
-
+    ConstantInt *Const = cast<ConstantInt>(II->getOperand(2));
     const Type *Ty = CI.getType();
 
+    // 0 is maximum number of bytes left, 1 is minimum number of bytes left.
+    // TODO: actually add these values, the current return values are "don't
+    // know".
     if (Const->getZExtValue() == 0)
       return ReplaceInstUsesWith(CI, Constant::getAllOnesValue(Ty));
     else