1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -run-twice -reassociate %s -S -o - | FileCheck %s
3 ; RUN: opt -run-twice -reassociate %s -S -o - | FileCheck %s
5 ; The PairMap[NumBinaryOps] used by the Reassociate pass used to have Value
6 ; *pointers as keys and no handling for values being removed. In some cases (in
7 ; practice very rarely, but in this particular test - well over 50% of the time)
8 ; a newly created Value would happen to get allocated at the same memory
9 ; address, effectively "replacing" the key in the map.
11 ; Test that that doesn't happen anymore and the pass is deterministic.
13 ; The failure rate of this test (at least, on my 8 core iMac), when ran in the
14 ; context of other unit tests executed | specifically, I was trying
16 ; ./bin/llvm-lit -v ../test/Transforms/Reassociate
20 ; # of RUN lines repeated | just -run-twice | -run-twice and CHECK lines
21 ; ------------------------+-----------------+---------------------------
22 ; 1 | 30% | <didn't measure>
24 ; 3 | 55% | <didn't measure>
26 ; hence the specific shape of this test. The IR itself comes from a real-world
27 ; code, successfully bugpointed.
29 define float @test(float %arg) {
32 ; CHECK-NEXT: [[TMP:%.*]] = fmul fast float [[ARG:%.*]], 0x3FE99999A0000000
33 ; CHECK-NEXT: [[TMP110:%.*]] = fsub fast float 1.000000e+00, [[TMP]]
34 ; CHECK-NEXT: [[TMP2:%.*]] = fmul fast float [[ARG]], 0x3FE99999A0000000
35 ; CHECK-NEXT: [[TMP311:%.*]] = fsub fast float 1.000000e+00, [[TMP2]]
36 ; CHECK-NEXT: [[REASS_MUL160:%.*]] = fmul fast float [[TMP110]], [[ARG]]
37 ; CHECK-NEXT: [[TMP4:%.*]] = fmul fast float [[REASS_MUL160]], [[TMP311]]
38 ; CHECK-NEXT: [[TMP5:%.*]] = fadd fast float [[TMP4]], [[ARG]]
39 ; CHECK-NEXT: [[TMP6:%.*]] = fmul fast float [[TMP5]], [[ARG]]
40 ; CHECK-NEXT: [[TMP7:%.*]] = fadd fast float [[TMP6]], [[ARG]]
41 ; CHECK-NEXT: [[TMP8:%.*]] = fmul fast float [[TMP7]], [[ARG]]
42 ; CHECK-NEXT: [[TMP9:%.*]] = fadd fast float [[TMP8]], [[ARG]]
43 ; CHECK-NEXT: [[TMP10:%.*]] = fmul fast float [[TMP9]], [[ARG]]
44 ; CHECK-NEXT: [[TMP11:%.*]] = fadd fast float [[TMP10]], [[ARG]]
45 ; CHECK-NEXT: [[TMP12:%.*]] = fmul fast float [[TMP11]], [[ARG]]
46 ; CHECK-NEXT: [[TMP13:%.*]] = fadd fast float [[TMP12]], [[ARG]]
47 ; CHECK-NEXT: [[TMP14:%.*]] = fmul fast float [[TMP13]], [[ARG]]
48 ; CHECK-NEXT: [[TMP15:%.*]] = fadd fast float [[TMP14]], [[ARG]]
49 ; CHECK-NEXT: [[TMP16:%.*]] = fmul fast float [[TMP15]], [[ARG]]
50 ; CHECK-NEXT: [[TMP17:%.*]] = fadd fast float [[TMP16]], [[ARG]]
51 ; CHECK-NEXT: [[TMP18:%.*]] = fmul fast float [[TMP17]], [[ARG]]
52 ; CHECK-NEXT: [[TMP19:%.*]] = fadd fast float [[TMP18]], [[ARG]]
53 ; CHECK-NEXT: [[TMP20:%.*]] = fmul fast float [[TMP19]], [[ARG]]
54 ; CHECK-NEXT: [[TMP21:%.*]] = fadd fast float [[TMP20]], [[ARG]]
55 ; CHECK-NEXT: [[TMP22:%.*]] = fmul fast float [[TMP21]], [[ARG]]
56 ; CHECK-NEXT: [[TMP23:%.*]] = fadd fast float [[TMP22]], [[ARG]]
57 ; CHECK-NEXT: [[REASS_MUL166:%.*]] = fmul fast float [[ARG]], [[ARG]]
58 ; CHECK-NEXT: [[TMP24:%.*]] = fmul fast float [[REASS_MUL166]], [[TMP23]]
59 ; CHECK-NEXT: [[TMP25:%.*]] = fadd fast float [[TMP24]], [[ARG]]
60 ; CHECK-NEXT: [[TMP26:%.*]] = fmul fast float [[TMP25]], [[ARG]]
61 ; CHECK-NEXT: [[TMP27:%.*]] = fadd fast float [[TMP26]], [[ARG]]
62 ; CHECK-NEXT: [[TMP29:%.*]] = fmul fast float [[ARG]], [[ARG]]
63 ; CHECK-NEXT: [[TMP31:%.*]] = fmul fast float [[TMP29]], 0x3FEA2E8B80000000
64 ; CHECK-NEXT: [[TMP33:%.*]] = fmul fast float [[TMP31]], [[TMP27]]
65 ; CHECK-NEXT: [[TMP34:%.*]] = fadd fast float [[TMP33]], [[ARG]]
66 ; CHECK-NEXT: ret float [[TMP34]]
69 %tmp = fmul fast float %arg, 0xBFE99999A0000000
70 %tmp1 = fadd fast float %tmp, 1.000000e+00
71 %tmp2 = fmul fast float %arg, 0xBFE99999A0000000
72 %tmp3 = fadd fast float %tmp2, 1.000000e+00
73 %reass.mul156 = fmul fast float %arg, %tmp1
74 %reass.mul160 = fmul fast float %arg, %tmp1
75 %tmp4 = fmul fast float %reass.mul160, %tmp3
76 %tmp5 = fadd fast float %arg, %tmp4
77 %tmp6 = fmul fast float %tmp5, %arg
78 %tmp7 = fadd fast float %tmp6, %arg
79 %tmp8 = fmul fast float %tmp7, %arg
80 %tmp9 = fadd fast float %arg, %tmp8
81 %tmp10 = fmul fast float %tmp9, %arg
82 %tmp11 = fadd fast float %tmp10, %arg
83 %tmp12 = fmul fast float %tmp11, %arg
84 %tmp13 = fadd fast float %tmp12, %arg
85 %tmp14 = fmul fast float %tmp13, %arg
86 %tmp15 = fadd fast float %arg, %tmp14
87 %tmp16 = fmul fast float %tmp15, %arg
88 %tmp17 = fadd fast float %tmp16, %arg
89 %tmp18 = fmul fast float %tmp17, %arg
90 %tmp19 = fadd fast float %tmp18, %arg
91 %tmp20 = fmul fast float %tmp19, %arg
92 %tmp21 = fadd fast float %tmp20, %arg
93 %tmp22 = fmul fast float %tmp21, %arg
94 %tmp23 = fadd fast float %tmp22, %arg
95 %reass.mul166 = fmul fast float %arg, %tmp23
96 %tmp24 = fmul fast float %reass.mul166, %arg
97 %tmp25 = fadd fast float %arg, %tmp24
98 %tmp26 = fmul fast float %arg, %tmp25
99 %tmp27 = fadd fast float %tmp26, %arg
100 %tmp28 = fmul fast float %arg, %tmp27
101 %tmp29 = fmul fast float %tmp28, %arg
102 %tmp31 = fmul fast float %tmp29, 0x3FED1745C0000000
103 %tmp33 = fmul fast float %tmp31, 0x3FECCCCCC0000000
104 %tmp34 = fadd fast float %arg, %tmp33