1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5
2 ; RUN: opt -passes=early-cse -S %s | FileCheck %s
4 define i32 @samesign_hash_bug(i16 %v) {
5 ; CHECK-LABEL: define i32 @samesign_hash_bug(
6 ; CHECK-SAME: i16 [[V:%.*]]) {
7 ; CHECK-NEXT: [[ZEXT:%.*]] = zext i16 [[V]] to i32
8 ; CHECK-NEXT: [[ICMP_SAMESIGN:%.*]] = icmp ugt i32 [[ZEXT]], 31
9 ; CHECK-NEXT: [[SELECT_ICMP_SAMESIGN:%.*]] = select i1 [[ICMP_SAMESIGN]], i32 0, i32 1
10 ; CHECK-NEXT: [[SELECT_ICMP:%.*]] = select i1 [[ICMP_SAMESIGN]], i32 1, i32 0
11 ; CHECK-NEXT: ret i32 [[SELECT_ICMP]]
13 %zext = zext i16 %v to i32
14 %icmp.samesign = icmp samesign ugt i32 %zext, 31
15 %select.icmp.samesign = select i1 %icmp.samesign, i32 0, i32 1
16 %ashr = ashr i32 0, %select.icmp.samesign
17 %icmp = icmp ugt i32 %zext, 31
18 %select.icmp = select i1 %icmp, i32 1, i32 0
19 %ret = add i32 %ashr, %select.icmp