summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGDecl.cpp
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2008-12-20 23:11:59 +0000
committerEli Friedman <eli.friedman@gmail.com>2008-12-20 23:11:59 +0000
commitf4084708cdd74b79198c42d859fefac4309900b3 (patch)
treecb15a2dc37496e52dad9f8759035831f1a333bcd /clang/lib/CodeGen/CGDecl.cpp
parent5d985f5f16eddd2af0ac091c4832caa5ba8b1a36 (diff)
downloadbcm5719-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.cpp12
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;
OpenPOWER on IntegriCloud