summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExprScalar.cpp
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2016-08-16 09:45:36 +0000
committerJames Molloy <james.molloy@arm.com>2016-08-16 09:45:36 +0000
commit59802321785b4b9fc31b10456c62ba3a06d3a631 (patch)
tree9972dd07f70520851b4bed007d4ee1a8f074ab42 /clang/lib/CodeGen/CGExprScalar.cpp
parent5a123c4e37d9969a7c1a0d2b470db9330267817b (diff)
downloadbcm5719-llvm-59802321785b4b9fc31b10456c62ba3a06d3a631.tar.gz
bcm5719-llvm-59802321785b4b9fc31b10456c62ba3a06d3a631.zip
Left shifts of negative values are defined if -fwrapv is set
This means we shouldn't emit ubsan detection code or warn. Fixes PR25552. llvm-svn: 278786
Diffstat (limited to 'clang/lib/CodeGen/CGExprScalar.cpp')
-rw-r--r--clang/lib/CodeGen/CGExprScalar.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGExprScalar.cpp b/clang/lib/CodeGen/CGExprScalar.cpp
index f3936873359..700b5374ad9 100644
--- a/clang/lib/CodeGen/CGExprScalar.cpp
+++ b/clang/lib/CodeGen/CGExprScalar.cpp
@@ -2714,7 +2714,8 @@ Value *ScalarExprEmitter::EmitShl(const BinOpInfo &Ops) {
RHS = Builder.CreateIntCast(RHS, Ops.LHS->getType(), false, "sh_prom");
bool SanitizeBase = CGF.SanOpts.has(SanitizerKind::ShiftBase) &&
- Ops.Ty->hasSignedIntegerRepresentation();
+ Ops.Ty->hasSignedIntegerRepresentation() &&
+ !CGF.getLangOpts().isSignedOverflowDefined();
bool SanitizeExponent = CGF.SanOpts.has(SanitizerKind::ShiftExponent);
// OpenCL 6.3j: shift values are effectively % word size of LHS.
if (CGF.getLangOpts().OpenCL)
OpenPOWER on IntegriCloud