aboutsummaryrefslogtreecommitdiff
path: root/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
commit8f39f5e96ce4a5f401f431f61db7df1cf05dce6f (patch)
tree1516014931caadbe009dd48ee1ab8ac900abc638 /lib/CodeGen/CGDecl.cpp
parentfcdbb93749ed69aa9022437052c390522355ec3d (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@61291 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGDecl.cpp')
-rw-r--r--lib/CodeGen/CGDecl.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/lib/CodeGen/CGDecl.cpp b/lib/CodeGen/CGDecl.cpp
index 86bc347576..db6aae6dfd 100644
--- a/lib/CodeGen/CGDecl.cpp
+++ b/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;