aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/integer-overflow.c
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-06-26 22:18:28 +0000
committerChris Lattner <sabre@nondot.org>2010-06-26 22:18:28 +0000
commit640d3267228415328c0feb2bcc35757230ab4db7 (patch)
treef0c09c658ded6761213023fd91baf3dee72f62b6 /test/CodeGen/integer-overflow.c
parent8c11a65c18ae607b7073e1e451264492d2297726 (diff)
fix inc/dec to honor -fwrapv and -ftrapv, implementing PR7426.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@106962 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/integer-overflow.c')
-rw-r--r--test/CodeGen/integer-overflow.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/test/CodeGen/integer-overflow.c b/test/CodeGen/integer-overflow.c
index dea3d0a1a3..9bed741b32 100644
--- a/test/CodeGen/integer-overflow.c
+++ b/test/CodeGen/integer-overflow.c
@@ -21,13 +21,25 @@ void test1() {
// TRAPV: llvm.ssub.with.overflow.i32
f11G = a - b;
- // DEFAULT: sub nsw i32 0,
- // WRAPV: sub i32 0,
- // TRAPV: llvm.ssub.with.overflow.i32
- f11G = -a;
-
// DEFAULT: mul nsw i32
// WRAPV: mul i32
// TRAPV: llvm.smul.with.overflow.i32
f11G = a * b;
+
+ // DEFAULT: sub nsw i32 0,
+ // WRAPV: sub i32 0,
+ // TRAPV: llvm.ssub.with.overflow.i32(i32 0
+ f11G = -a;
+
+ // PR7426 - Overflow checking for increments.
+
+ // DEFAULT: add nsw i32 {{.*}}, 1
+ // WRAPV: add i32 {{.*}}, 1
+ // TRAPV: llvm.sadd.with.overflow.i32({{.*}}, i32 1)
+ ++a;
+
+ // DEFAULT: add nsw i32 {{.*}}, -1
+ // WRAPV: add i32 {{.*}}, -1
+ // TRAPV: llvm.sadd.with.overflow.i32({{.*}}, i32 -1)
+ --a;
}