Skip to content
Snippets Groups Projects
Commit 6535a57f authored by Eli Friedman's avatar Eli Friedman
Browse files

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.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@291805 91177308-0d34-0410-b5e6-96231b3b80d8
parent 3840cfcb
Branches
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment