• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S -mergefunc < %s | FileCheck %s
2
3; Ensure that we do not merge functions that are identical with the
4; exception of the order of the incoming blocks to a phi.
5
6; CHECK-LABEL: define linkonce_odr hidden i1 @first(i2)
7define linkonce_odr hidden i1 @first(i2) {
8entry:
9; CHECK: switch i2
10  switch i2 %0, label %default [
11    i2 0, label %L1
12    i2 1, label %L2
13    i2 -2, label %L3
14  ]
15default:
16  unreachable
17L1:
18  br label %done
19L2:
20  br label %done
21L3:
22  br label %done
23done:
24  %result = phi i1 [ true, %L1 ], [ false, %L2 ], [ false, %L3 ]
25; CHECK: ret i1
26  ret i1 %result
27}
28
29; CHECK-LABEL: define linkonce_odr hidden i1 @second(i2)
30define linkonce_odr hidden i1 @second(i2) {
31entry:
32; CHECK: switch i2
33  switch i2 %0, label %default [
34    i2 0, label %L1
35    i2 1, label %L2
36    i2 -2, label %L3
37  ]
38default:
39  unreachable
40L1:
41  br label %done
42L2:
43  br label %done
44L3:
45  br label %done
46done:
47  %result = phi i1 [ true, %L3 ], [ false, %L2 ], [ false, %L1 ]
48; CHECK: ret i1
49  ret i1 %result
50}
51