OSDN Git Service

Make sure we return the right sized type here.
authorEric Christopher <echristo@apple.com>
Wed, 28 Oct 2009 21:32:16 +0000 (21:32 +0000)
committerEric Christopher <echristo@apple.com>
Wed, 28 Oct 2009 21:32:16 +0000 (21:32 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85436 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/SelectionDAG/SelectionDAGBuild.cpp

index f86e584..dfe24ae 100644 (file)
@@ -4220,10 +4220,13 @@ SelectionDAGLowering::visitIntrinsicCall(CallInst &I, unsigned Intrinsic) {
 
     assert(CI && "Non-constant type in __builtin_object_size?");
 
+    SDValue Arg = getValue(I.getOperand(0));
+    EVT Ty = Arg.getValueType();
+
     if (CI->getZExtValue() < 2)
-      setValue(&I, DAG.getConstant(-1, MVT::i32));
+      setValue(&I, DAG.getConstant(-1, Ty));
     else
-      setValue(&I, DAG.getConstant(0, MVT::i32));
+      setValue(&I, DAG.getConstant(0, Ty));
     return 0;
   }
   case Intrinsic::var_annotation: