[cfe-commits] r123360 - in /cfe/trunk: lib/CodeGen/CGExprAgg.cpp lib/CodeGen/CGExprComplex.cpp lib/CodeGen/CGExprScalar.cpp test/CodeGen/exprs.c
John McCall
rjmccall at apple.com
Wed Jan 12 18:03:06 PST 2011
Author: rjmccall
Date: Wed Jan 12 20:03:06 2011
New Revision: 123360
URL: http://llvm.org/viewvc/llvm-project?rev=123360&view=rev
Log:
Ensure an insertion point at the end of a statement-expression.
Fixes PR8967.
Modified:
cfe/trunk/lib/CodeGen/CGExprAgg.cpp
cfe/trunk/lib/CodeGen/CGExprComplex.cpp
cfe/trunk/lib/CodeGen/CGExprScalar.cpp
cfe/trunk/test/CodeGen/exprs.c
Modified: cfe/trunk/lib/CodeGen/CGExprAgg.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprAgg.cpp?rev=123360&r1=123359&r2=123360&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprAgg.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprAgg.cpp Wed Jan 12 20:03:06 2011
@@ -368,6 +368,7 @@
void AggExprEmitter::VisitStmtExpr(const StmtExpr *E) {
CGF.EmitCompoundStmt(*E->getSubStmt(), true, Dest);
+ CGF.EnsureInsertPoint();
}
void AggExprEmitter::VisitBinaryOperator(const BinaryOperator *E) {
Modified: cfe/trunk/lib/CodeGen/CGExprComplex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprComplex.cpp?rev=123360&r1=123359&r2=123360&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprComplex.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprComplex.cpp Wed Jan 12 20:03:06 2011
@@ -313,8 +313,7 @@
ComplexPairTy ComplexExprEmitter::
VisitImaginaryLiteral(const ImaginaryLiteral *IL) {
llvm::Value *Imag = CGF.EmitScalarExpr(IL->getSubExpr());
- return
- ComplexPairTy(llvm::Constant::getNullValue(Imag->getType()), Imag);
+ return ComplexPairTy(llvm::Constant::getNullValue(Imag->getType()), Imag);
}
@@ -326,7 +325,9 @@
}
ComplexPairTy ComplexExprEmitter::VisitStmtExpr(const StmtExpr *E) {
- return CGF.EmitCompoundStmt(*E->getSubStmt(), true).getComplexVal();
+ RValue result = CGF.EmitCompoundStmt(*E->getSubStmt(), true);
+ CGF.EnsureInsertPoint();
+ return result.getComplexVal();
}
/// EmitComplexToComplexCast - Emit a cast from complex value Val to DestType.
@@ -635,7 +636,6 @@
ComplexPairTy ComplexExprEmitter::VisitBinComma(const BinaryOperator *E) {
CGF.EmitIgnoredExpr(E->getLHS());
- CGF.EnsureInsertPoint();
return Visit(E->getRHS());
}
Modified: cfe/trunk/lib/CodeGen/CGExprScalar.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGExprScalar.cpp?rev=123360&r1=123359&r2=123360&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGExprScalar.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGExprScalar.cpp Wed Jan 12 20:03:06 2011
@@ -1204,8 +1204,10 @@
}
Value *ScalarExprEmitter::VisitStmtExpr(const StmtExpr *E) {
- return CGF.EmitCompoundStmt(*E->getSubStmt(),
- !E->getType()->isVoidType()).getScalarVal();
+ RValue value = CGF.EmitCompoundStmt(*E->getSubStmt(),
+ !E->getType()->isVoidType());
+ CGF.EnsureInsertPoint();
+ return value.getScalarVal();
}
Value *ScalarExprEmitter::VisitBlockDeclRefExpr(const BlockDeclRefExpr *E) {
Modified: cfe/trunk/test/CodeGen/exprs.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/exprs.c?rev=123360&r1=123359&r2=123360&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/exprs.c (original)
+++ cfe/trunk/test/CodeGen/exprs.c Wed Jan 12 20:03:06 2011
@@ -166,3 +166,11 @@
// CHECK-NOT: load
// CHECK: ret void
}
+
+// PR8967: this was crashing
+// CHECK: define void @f16()
+void f16() {
+ __extension__({ goto lbl; });
+ lbl:
+ ;
+}
More information about the cfe-commits
mailing list