From d286f05f1234bac289173f0eed88d7ecbaea0099 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Sun, 19 Jul 2009 06:58:07 +0000 Subject: Avoid generation of dead code in a few more situations. - Emit variable declarations as "simple", we want to avoid forcing the creation of a dummy basic block, but still need to make the variable available for later use. - With that, we can now skip IRgen for other unreachable statements (which don't define a label). - Anders, I added two fixmes on calls to EmitVLASize, can you check them? git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@76361 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenFunction.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lib/CodeGen/CodeGenFunction.cpp') diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index a72f2ae710..e41476e650 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -450,19 +450,19 @@ void CodeGenFunction::EmitIndirectSwitches() { } } -llvm::Value *CodeGenFunction::GetVLASize(const VariableArrayType *VAT) -{ +llvm::Value *CodeGenFunction::GetVLASize(const VariableArrayType *VAT) { llvm::Value *&SizeEntry = VLASizeMap[VAT]; assert(SizeEntry && "Did not emit size for type"); return SizeEntry; } -llvm::Value *CodeGenFunction::EmitVLASize(QualType Ty) -{ +llvm::Value *CodeGenFunction::EmitVLASize(QualType Ty) { assert(Ty->isVariablyModifiedType() && "Must pass variably modified type to EmitVLASizes!"); + EnsureInsertPoint(); + if (const VariableArrayType *VAT = getContext().getAsVariableArrayType(Ty)) { llvm::Value *&SizeEntry = VLASizeMap[VAT]; -- cgit v1.2.3