diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-07-19 06:58:07 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-07-19 06:58:07 +0000 |
commit | b6adc43f6ec4d2c1eef7b00d3f6460fe2d7be381 (patch) | |
tree | daeb510d033b1056dea4926228383466d8dd8f12 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 567daf3ce8ee278893b4065cfb13feae8d2c82a4 (diff) | |
download | bcm5719-llvm-b6adc43f6ec4d2c1eef7b00d3f6460fe2d7be381.tar.gz bcm5719-llvm-b6adc43f6ec4d2c1eef7b00d3f6460fe2d7be381.zip |
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?
llvm-svn: 76361
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index a72f2ae7106..e41476e6503 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/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]; |