25 lines · c
1// RUN: %clang_cc1 -emit-llvm-bc -disable-llvm-passes -o %t.bc %s2// RUN: llvm-dis %t.bc -o - | FileCheck %s3 4// Test case for PR45426. Make sure we do not crash while writing bitcode5// containing a simplify-able fneg constant expression.6//7// CHECK-LABEL define i32 @main()8// CHECK: entry:9// CHECK-NEXT: %retval = alloca i3210// CHECK-NEXT: store i32 0, ptr %retval11// CHECK-NEXT: [[CMP:%.*]] = icmp ne ptr @b, @a12// CHECK-NEXT: [[ZEXT:%.*]] = zext i1 [[CMP]] to i3213// CHECK-NEXT: [[SITOFP:%.*]] = sitofp i32 [[ZEXT]] to float14// CHECK-NEXT: [[LV:%.*]] = load ptr, ptr @c15// CHECK-NEXT: store float [[SITOFP]], ptr [[LV]], align 416// CHECK-NEXT: [[FNEG:%.*]] = fneg float [[SITOFP]]17// CHECK-NEXT: [[CONV:%.*]] = fptosi float [[FNEG]] to i3218// CHECK-NEXT: ret i32 [[CONV]]19 20int a[], b;21float *c;22int main(void) {23 return -(*c = &b != a);24}25