summaryrefslogtreecommitdiffstats
path: root/lib/CodeGen/CGExprScalar.cpp
diff options
context:
space:
mode:
authorrdivacky <rdivacky@FreeBSD.org>2010-04-02 08:55:10 +0000
committerrdivacky <rdivacky@FreeBSD.org>2010-04-02 08:55:10 +0000
commit07b2cfcdb817cc0790420f159a313d61e7241cb9 (patch)
treed374cdca417e76f1bf101f139dba2db1d10ee8f7 /lib/CodeGen/CGExprScalar.cpp
parent1e255aab650a7fa2047fd953cae65b12215280af (diff)
downloadFreeBSD-src-07b2cfcdb817cc0790420f159a313d61e7241cb9.zip
FreeBSD-src-07b2cfcdb817cc0790420f159a313d61e7241cb9.tar.gz
Update clang to r100181.
Diffstat (limited to 'lib/CodeGen/CGExprScalar.cpp')
-rw-r--r--lib/CodeGen/CGExprScalar.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/CodeGen/CGExprScalar.cpp b/lib/CodeGen/CGExprScalar.cpp
index 7e26971..42bf68e 100644
--- a/lib/CodeGen/CGExprScalar.cpp
+++ b/lib/CodeGen/CGExprScalar.cpp
@@ -769,6 +769,9 @@ Value *ScalarExprEmitter::VisitInitListExpr(InitListExpr *E) {
static bool ShouldNullCheckClassCastValue(const CastExpr *CE) {
const Expr *E = CE->getSubExpr();
+
+ if (CE->getCastKind() == CastExpr::CK_UncheckedDerivedToBase)
+ return false;
if (isa<CXXThisExpr>(E)) {
// We always assume that 'this' is never null.
@@ -826,6 +829,7 @@ Value *ScalarExprEmitter::EmitCastExpr(CastExpr *CE) {
return CGF.GetAddressOfDerivedClass(Src, BaseClassDecl, DerivedClassDecl,
NullCheckValue);
}
+ case CastExpr::CK_UncheckedDerivedToBase:
case CastExpr::CK_DerivedToBase: {
const RecordType *DerivedClassTy =
E->getType()->getAs<PointerType>()->getPointeeType()->getAs<RecordType>();
@@ -1337,6 +1341,11 @@ Value *ScalarExprEmitter::EmitSub(const BinOpInfo &Ops) {
if (Ops.LHS->getType()->isFPOrFPVectorTy())
return Builder.CreateFSub(Ops.LHS, Ops.RHS, "sub");
+
+ // Signed integer overflow is undefined behavior.
+ if (Ops.Ty->isSignedIntegerType())
+ return Builder.CreateNSWSub(Ops.LHS, Ops.RHS, "sub");
+
return Builder.CreateSub(Ops.LHS, Ops.RHS, "sub");
}
OpenPOWER on IntegriCloud