1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -simplifycfg -S < %s | FileCheck %s
4 ; sdiv INT_MIN / -1 should not be speculated.
5 define i32 @test(i1 %cmp) {
7 ; CHECK-NEXT: br i1 [[CMP:%.*]], label [[IF:%.*]], label [[COMMON_RET:%.*]]
9 ; CHECK-NEXT: [[DIV:%.*]] = sdiv i32 -2147483648, -1
10 ; CHECK-NEXT: [[CMP2:%.*]] = icmp ne i32 [[DIV]], 0
11 ; CHECK-NEXT: [[SPEC_SELECT:%.*]] = select i1 [[CMP2]], i32 1, i32 0
12 ; CHECK-NEXT: br label [[COMMON_RET]]
14 ; CHECK-NEXT: [[COMMON_RET_OP:%.*]] = phi i32 [ 0, [[TMP0:%.*]] ], [ [[SPEC_SELECT]], [[IF]] ]
15 ; CHECK-NEXT: ret i32 [[COMMON_RET_OP]]
17 br i1 %cmp, label %if, label %else
20 %div = sdiv i32 -2147483648, -1
21 %cmp2 = icmp ne i32 %div, 0
22 br i1 %cmp2, label %end, label %else