summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInvocation.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-05-02 23:46:56 +0000
committerVedant Kumar <vsk@apple.com>2017-05-02 23:46:56 +0000
commitd919115983a85f1b772f90d945a4ee8360771c36 (patch)
treed9985663621c1964229c3da1a0858b86904cdb0d /clang/lib/Frontend/CompilerInvocation.cpp
parent67736594f7cc1f789060a89f0bc981b58b66bca1 (diff)
downloadbcm5719-llvm-d919115983a85f1b772f90d945a4ee8360771c36.tar.gz
bcm5719-llvm-d919115983a85f1b772f90d945a4ee8360771c36.zip
[ubsan] Skip overflow checks on safe arithmetic (fixes PR32874)
Currently, ubsan emits overflow checks for arithmetic that is known to be safe at compile-time, e.g: 1 + 1 => CheckedAdd(1, 1) This leads to breakage when using the __builtin_prefetch intrinsic. LLVM expects the arguments to @llvm.prefetch to be constant integers, and when ubsan inserts unnecessary checks on the operands to the intrinsic, this contract is broken, leading to verifier failures (see PR32874). Instead of special-casing __builtin_prefetch for ubsan, this patch fixes the underlying problem, i.e that clang currently emits unnecessary overflow checks. Testing: I ran the check-clang and check-ubsan targets with a stage2, ubsan-enabled build of clang. I added a regression test for PR32874, and some extra checking to make sure we don't regress runtime checking for unsafe arithmetic. The existing ubsan-promoted-arithmetic.cpp test also provides coverage for this change. llvm-svn: 301988
Diffstat (limited to 'clang/lib/Frontend/CompilerInvocation.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud