1 ; RUN: opt < %s -gvn -S | FileCheck %s 2 ; This testcase tests insertion of no-cost phis. That is, 3 ; when the value is already available in every predecessor, 4 ; and we just need to insert a phi node to merge the available values. 5 6 @c = global i32 0, align 4 7 @d = global i32 0, align 4 8 9 10 define i32 @mai(i32 %foo, i32 %a, i32 %b) { 11 %1 = icmp ne i32 %foo, 0 12 br i1 %1, label %bb1, label %bb2 13 14 bb1: 15 %2 = add nsw i32 %a, %b 16 store i32 %2, i32* @c, align 4 17 br label %mergeblock 18 19 bb2: 20 %3 = add nsw i32 %a, %b 21 store i32 %3, i32* @d, align 4 22 br label %mergeblock 23 24 mergeblock: 25 ; CHECK: pre-phi = phi i32 [ %3, %bb2 ], [ %2, %bb1 ] 26 ; CHECK-NEXT: ret i32 %.pre-phi 27 %4 = add nsw i32 %a, %b 28 ret i32 %4 29 } 30 31 32