Follow Eli's advice and store the VLA size with the native size_t type. Fixes PR3491.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@63879 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index 898c1bf..73d3e21 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/lib/CodeGen/CGDecl.cpp
@@ -197,6 +197,9 @@
 
     llvm::Value *VLASize = EmitVLASize(Ty);
 
+    // Downcast the VLA size expression
+    VLASize = Builder.CreateIntCast(VLASize, llvm::Type::Int32Ty, false, "tmp");
+    
     // Allocate memory for the array.
     llvm::Value *VLA = Builder.CreateAlloca(llvm::Type::Int8Ty, VLASize, "vla");
     DeclPtr = Builder.CreateBitCast(VLA, LElemPtrTy, "tmp");