blob: 7e4a3278c9ed836641dead160b28ddc9e42dd8b1 [file] [log] [blame]
Sanjay Patelee770e92018-03-08 22:05:27 +00001; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
Mehdi Amini590a2702015-01-16 03:00:58 +00002; RUN: opt -reassociate %s -S -o - | FileCheck %s
3
4; Reassociate pass used to crash on these example
5
Sanjay Patelee770e92018-03-08 22:05:27 +00006@g = global i32 0
Mehdi Amini590a2702015-01-16 03:00:58 +00007
8define float @undef1() {
Sanjay Patelee770e92018-03-08 22:05:27 +00009; CHECK-LABEL: @undef1(
10; CHECK-NEXT: ret float fadd (float bitcast (i32 ptrtoint (i32* @g to i32) to float), float fadd (float bitcast (i32 ptrtoint (i32* @g to i32) to float), float fadd (float fsub (float -0.000000e+00, float bitcast (i32 ptrtoint (i32* @g to i32) to float)), float fsub (float -0.000000e+00, float bitcast (i32 ptrtoint (i32* @g to i32) to float)))))
11;
12 %t0 = fadd fast float bitcast (i32 ptrtoint (i32* @g to i32) to float), bitcast (i32 ptrtoint (i32* @g to i32) to float)
13 %t1 = fsub fast float bitcast (i32 ptrtoint (i32* @g to i32) to float), %t0
14 %t2 = fadd fast float bitcast (i32 ptrtoint (i32* @g to i32) to float), %t1
15 ret float %t2
Mehdi Amini590a2702015-01-16 03:00:58 +000016}
17
18define void @undef2() {
Sanjay Patelee770e92018-03-08 22:05:27 +000019; CHECK-LABEL: @undef2(
20; CHECK-NEXT: unreachable
21;
22 %t0 = fadd fast float bitcast (i32 ptrtoint (i32* @g to i32) to float), bitcast (i32 ptrtoint (i32* @g to i32) to float)
23 %t1 = fadd fast float %t0, 1.0
24 %t2 = fsub fast float %t0, %t1
25 %t3 = fmul fast float %t2, 2.0
Mehdi Amini590a2702015-01-16 03:00:58 +000026 unreachable
27}
Sanjay Patelee770e92018-03-08 22:05:27 +000028