1; RUN: opt < %s -reassociate -stats -S 2>&1 | FileCheck %s 2; REQUIRES: asserts 3 4define i8 @longchain(i8 %in1, i8 %in2, i8 %in3, i8 %in4, i8 %in5, i8 %in6, i8 %in7, i8 %in8, i8 %in9, i8 %in10, i8 %in11, i8 %in12, i8 %in13, i8 %in14, i8 %in15, i8 %in16, i8 %in17, i8 %in18, i8 %in19, i8 %in20) { 5 %tmp1 = add i8 %in1, %in2 6 %tmp2 = add i8 %tmp1, %in3 7 %tmp3 = add i8 %tmp2, %in4 8 %tmp4 = add i8 %tmp3, %in3 9 %tmp5 = add i8 %tmp4, %in4 10 %tmp6 = add i8 %tmp5, %in5 11 %tmp7 = add i8 %tmp6, %in6 12 %tmp8 = add i8 %tmp7, %in7 13 %tmp9 = add i8 %tmp8, %in8 14 %tmp10 = add i8 %tmp9, %in9 15 %tmp11 = add i8 %tmp10, %in10 16 %tmp12 = add i8 %tmp11, %in11 17 %tmp13 = add i8 %tmp12, %in12 18 %tmp14 = add i8 %tmp13, %in13 19 %tmp15 = add i8 %tmp14, %in14 20 %tmp16 = add i8 %tmp15, %in15 21 %tmp17 = add i8 %tmp16, %in16 22 %tmp18 = add i8 %tmp17, %in17 23 %tmp19 = add i8 %tmp18, %in18 24 %tmp20 = add i8 %tmp19, %in19 25 %tmp21 = add i8 %tmp20, %in20 26 ret i8 %tmp20 27} 28 29; Check the number of instructions reassociated is in the tens not the hundreds. 30; At the time of writing, the exact numbers were: 31; Bad order: 220 reassociate - Number of insts reassociated 32; Good order: 55 reassociate - Number of insts reassociated 33; 34; CHECK: {{^[1-9][0-9]}} reassociate - Number of insts reassociated 35 36; Additionally check that we made at least three changes. 37; CHECK: {{^ *[3-9]}} reassociate - Number of multiplies factored 38