1 // RUN: %clang_cc1 -emit-llvm-bc -disable-llvm-passes -o %t.bc %s
2 // RUN: llvm-dis %t.bc -o - | FileCheck %s
4 // Test case for PR45426. Make sure we do not crash while writing bitcode
5 // containing a simplify-able fneg constant expression.
7 // CHECK-LABEL define i32 @main()
9 // CHECK-NEXT: %retval = alloca i32
10 // CHECK-NEXT: store i32 0, ptr %retval
11 // CHECK-NEXT: [[CMP:%.*]] = icmp ne ptr @b, @a
12 // CHECK-NEXT: [[ZEXT:%.*]] = zext i1 [[CMP]] to i32
13 // CHECK-NEXT: [[SITOFP:%.*]] = sitofp i32 [[ZEXT]] to float
14 // CHECK-NEXT: [[LV:%.*]] = load ptr, ptr @c
15 // CHECK-NEXT: store float [[SITOFP]], ptr [[LV]], align 4
16 // CHECK-NEXT: [[FNEG:%.*]] = fneg float [[SITOFP]]
17 // CHECK-NEXT: [[CONV:%.*]] = fptosi float [[FNEG]] to i32
18 // CHECK-NEXT: ret i32 [[CONV]]
23 return -(*c
= &b
!= a
);