diff options
author | Eli Friedman <eli.friedman@gmail.com> | 2011-05-06 18:04:18 +0000 |
---|---|---|
committer | Eli Friedman <eli.friedman@gmail.com> | 2011-05-06 18:04:18 +0000 |
commit | 409943efcb54d2d88d4a974e8f64e2ed53be2a2f (patch) | |
tree | cd83e028e7818f8765d78b2d7035579195fb8412 /clang/lib/CodeGen | |
parent | 20ce0c0ce029e560bce2749c017aaf08380f4a38 (diff) | |
download | bcm5719-llvm-409943efcb54d2d88d4a974e8f64e2ed53be2a2f.tar.gz bcm5719-llvm-409943efcb54d2d88d4a974e8f64e2ed53be2a2f.zip |
Don't emit nsw flags for vector operations; there's basically no benefit, and a lot of downside (like PR9850, which is about clang's xmmintrin.h making an unexpected transformation on an expression involving _mm_add_epi32).
llvm-svn: 131000
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGExprScalar.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp index 6bcc425ce62..abc375871f3 100644 --- a/clang/lib/CodeGen/CGExprScalar.cpp +++ b/clang/lib/CodeGen/CGExprScalar.cpp @@ -400,7 +400,7 @@ public: // Binary Operators. Value *EmitMul(const BinOpInfo &Ops) { - if (Ops.Ty->hasSignedIntegerRepresentation()) { + if (Ops.Ty->isSignedIntegerType()) { switch (CGF.getContext().getLangOptions().getSignedOverflowBehavior()) { case LangOptions::SOB_Undefined: return Builder.CreateNSWMul(Ops.LHS, Ops.RHS, "mul"); @@ -1333,10 +1333,7 @@ ScalarExprEmitter::EmitScalarPrePostIncDec(const UnaryOperator *E, LValue LV, if (type->hasIntegerRepresentation()) { llvm::Value *amt = llvm::ConstantInt::get(value->getType(), amount); - if (type->hasSignedIntegerRepresentation()) - value = EmitAddConsiderOverflowBehavior(E, value, amt, isInc); - else - value = Builder.CreateAdd(value, amt, isInc ? "inc" : "dec"); + value = Builder.CreateAdd(value, amt, isInc ? "inc" : "dec"); } else { value = Builder.CreateFAdd( value, @@ -1829,7 +1826,7 @@ Value *ScalarExprEmitter::EmitOverflowCheckedBinOp(const BinOpInfo &Ops) { Value *ScalarExprEmitter::EmitAdd(const BinOpInfo &Ops) { if (!Ops.Ty->isAnyPointerType()) { - if (Ops.Ty->hasSignedIntegerRepresentation()) { + if (Ops.Ty->isSignedIntegerType()) { switch (CGF.getContext().getLangOptions().getSignedOverflowBehavior()) { case LangOptions::SOB_Undefined: return Builder.CreateNSWAdd(Ops.LHS, Ops.RHS, "add"); @@ -1914,7 +1911,7 @@ Value *ScalarExprEmitter::EmitAdd(const BinOpInfo &Ops) { Value *ScalarExprEmitter::EmitSub(const BinOpInfo &Ops) { if (!isa<llvm::PointerType>(Ops.LHS->getType())) { - if (Ops.Ty->hasSignedIntegerRepresentation()) { + if (Ops.Ty->isSignedIntegerType()) { switch (CGF.getContext().getLangOptions().getSignedOverflowBehavior()) { case LangOptions::SOB_Undefined: return Builder.CreateNSWSub(Ops.LHS, Ops.RHS, "sub"); |