diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2008-12-20 23:11:59 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2008-12-20 23:11:59 +0000 |
commit | f4084708cdd74b79198c42d859fefac4309900b3 (patch) | |
tree | cb15a2dc37496e52dad9f8759035831f1a333bcd /clang/lib/CodeGen/CGDecl.cpp | |
parent | 5d985f5f16eddd2af0ac091c4832caa5ba8b1a36 (diff) | |
download | bcm5719-llvm-f4084708cdd74b79198c42d859fefac4309900b3.tar.gz bcm5719-llvm-f4084708cdd74b79198c42d859fefac4309900b3.zip |
Make VLAs usable, and make basic usage work correctly. Also, add a
simple test that actually does VLA codegen.
Note that despite the fact that the alloca isn't in the entry block, it
should dominate all uses; this is guaranteed by the restrictions on goto
into VLA scope in C99.
llvm-svn: 61291
Diffstat (limited to 'clang/lib/CodeGen/CGDecl.cpp')
-rw-r--r-- | clang/lib/CodeGen/CGDecl.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/clang/lib/CodeGen/CGDecl.cpp b/clang/lib/CodeGen/CGDecl.cpp index 86bc3475761..db6aae6dfd7 100644 --- a/clang/lib/CodeGen/CGDecl.cpp +++ b/clang/lib/CodeGen/CGDecl.cpp @@ -192,17 +192,9 @@ void CodeGenFunction::EmitLocalBlockVarDecl(const VarDecl &D) { // Allocate memory for the array. llvm::Value *VLA = Builder.CreateAlloca(llvm::Type::Int8Ty, VLASize, "vla"); - VLA = Builder.CreateBitCast(VLA, LElemPtrTy, "tmp"); - - llvm::AllocaInst *Alloc = - CreateTempAlloca(LElemPtrTy, D.getIdentifier()->getName()); - - // FIXME: Volatile? - Builder.CreateStore(VLA, Alloc); - - DeclPtr = Alloc; + DeclPtr = Builder.CreateBitCast(VLA, LElemPtrTy, "tmp"); } - + llvm::Value *&DMEntry = LocalDeclMap[&D]; assert(DMEntry == 0 && "Decl already exists in localdeclmap!"); DMEntry = DeclPtr; |