1; RUN: opt -S -instcombine < %s | FileCheck %s
2
3; Checking for a crash
4
5declare void @use.i1(i1 %val)
6declare void @use.i64(i64 %val)
7
8define i64 @f(i32 %x) {
9; CHECK-LABEL: @f(
10 entry:
11  %x.wide = sext i32 %x to i64
12  %minus.x = sub i32 0, %x
13  %minus.x.wide = sext i32 %minus.x to i64
14  %c = icmp slt i32 %x, 0
15  %val = select i1 %c, i64 %x.wide, i64 %minus.x.wide
16  call void @use.i1(i1 %c)
17  call void @use.i64(i64 %x.wide)
18  ret i64 %val
19; CHECK: ret i64 %val
20}
21