Unify the way we report overflow in increment/decrement operator.
authorAlexey Samsonov <vonosmas@gmail.com>
Thu, 23 Apr 2015 01:50:45 +0000 (01:50 +0000)
committerAlexey Samsonov <vonosmas@gmail.com>
Thu, 23 Apr 2015 01:50:45 +0000 (01:50 +0000)
commitf6246503546e88e834108170fc5455f7245d5a67
tree0e1d9c0734889f5c476c659fedb5243eb317374a
parent434984ef583edf64c13962fa092197410a950369
Unify the way we report overflow in increment/decrement operator.

Summary:
Make sure signed overflow in "x--" is checked with
llvm.ssub.with.overflow intrinsic and is reported as:
  "-2147483648 - 1 cannot be represented in type 'int'"
instead of:
  "-2147483648 + -1 cannot be represented in type 'int'"
, like we do for unsigned overflow.

Test Plan: clang + compiler-rt regression test suite

Reviewers: rsmith

Subscribers: cfe-commits

Differential Revision: http://reviews.llvm.org/D8236

llvm-svn: 235568
clang/lib/CodeGen/CGExprScalar.cpp
clang/test/CodeGen/integer-overflow.c