r291805 - Add additional testcases for nsw markings on ++ and --.
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Thu Jan 12 11:51:44 PST 2017
Author: efriedma
Date: Thu Jan 12 13:51:44 2017
New Revision: 291805
URL: http://llvm.org/viewvc/llvm-project?rev=291805&view=rev
Log:
Add additional testcases for nsw markings on ++ and --.
clang has generated correct IR for char/short decrement since r126816,
but we didn't have any test coverage for decrement.
Patch by Andrew Rogers.
Modified:
cfe/trunk/test/CodeGen/integer-overflow.c
Modified: cfe/trunk/test/CodeGen/integer-overflow.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/integer-overflow.c?rev=291805&r1=291804&r2=291805&view=diff
==============================================================================
--- cfe/trunk/test/CodeGen/integer-overflow.c (original)
+++ cfe/trunk/test/CodeGen/integer-overflow.c Thu Jan 12 13:51:44 2017
@@ -65,13 +65,37 @@ void test1() {
// TRAPV: getelementptr inbounds i32, i32*
// CATCH_UB: getelementptr inbounds i32, i32*
- // PR9350: char increment never overflows.
- extern volatile signed char PR9350;
+ // PR9350: char pre-increment never overflows.
+ extern volatile signed char PR9350_char_inc;
// DEFAULT: add i8 {{.*}}, 1
// WRAPV: add i8 {{.*}}, 1
// TRAPV: add i8 {{.*}}, 1
// CATCH_UB: add i8 {{.*}}, 1
- ++PR9350;
+ ++PR9350_char_inc;
+
+ // PR9350: char pre-decrement never overflows.
+ extern volatile signed char PR9350_char_dec;
+ // DEFAULT: add i8 {{.*}}, -1
+ // WRAPV: add i8 {{.*}}, -1
+ // TRAPV: add i8 {{.*}}, -1
+ // CATCH_UB: add i8 {{.*}}, -1
+ --PR9350_char_dec;
+
+ // PR9350: short pre-increment never overflows.
+ extern volatile signed short PR9350_short_inc;
+ // DEFAULT: add i16 {{.*}}, 1
+ // WRAPV: add i16 {{.*}}, 1
+ // TRAPV: add i16 {{.*}}, 1
+ // CATCH_UB: add i16 {{.*}}, 1
+ ++PR9350_short_inc;
+
+ // PR9350: short pre-decrement never overflows.
+ extern volatile signed short PR9350_short_dec;
+ // DEFAULT: add i16 {{.*}}, -1
+ // WRAPV: add i16 {{.*}}, -1
+ // TRAPV: add i16 {{.*}}, -1
+ // CATCH_UB: add i16 {{.*}}, -1
+ --PR9350_short_dec;
// PR24256: don't instrument __builtin_frame_address.
__builtin_frame_address(0 + 0);
More information about the cfe-commits
mailing list