1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: opt -disable-output -S -passes=print-ir-similarity < %s 2>&1 | FileCheck --allow-empty %s
3
4; Check to make sure that the IRSimilarityIdentifier and IRSimilarityPrinterPass
5; return items only within the same function when there are different sets of
6; instructions in functions.
7
8; CHECK: 2 candidates of length 3.  Found in:
9; CHECK-NEXT:   Function: turtle, Basic Block: (unnamed)
10; CHECK-NEXT:     Start Instruction:   %b = load i32, i32* %1, align 4
11; CHECK-NEXT:       End Instruction:   %d = load i32, i32* %3, align 4
12; CHECK-NEXT:   Function: turtle, Basic Block: (unnamed)
13; CHECK-NEXT:     Start Instruction:   %a = load i32, i32* %0, align 4
14; CHECK-NEXT:       End Instruction:   %c = load i32, i32* %2, align 4
15; CHECK-NEXT: 2 candidates of length 5.  Found in:
16; CHECK-NEXT:   Function: fish, Basic Block: entry
17; CHECK-NEXT:     Start Instruction:   store i32 6, i32* %0, align 4
18; CHECK-NEXT:       End Instruction:   store i32 4, i32* %4, align 4
19; CHECK-NEXT:   Function: fish, Basic Block: entry
20; CHECK-NEXT:     Start Instruction:   store i32 1, i32* %1, align 4
21; CHECK-NEXT:       End Instruction:   store i32 5, i32* %5, align 4
22
23define linkonce_odr void @fish() {
24entry:
25  %0 = alloca i32, align 4
26  %1 = alloca i32, align 4
27  %2 = alloca i32, align 4
28  %3 = alloca i32, align 4
29  %4 = alloca i32, align 4
30  %5 = alloca i32, align 4
31  store i32 6, i32* %0, align 4
32  store i32 1, i32* %1, align 4
33  store i32 2, i32* %2, align 4
34  store i32 3, i32* %3, align 4
35  store i32 4, i32* %4, align 4
36  store i32 5, i32* %5, align 4
37  ret void
38}
39
40define void @turtle(i32* %0, i32* %1, i32* %2, i32* %3) {
41  %a = load i32, i32* %0
42  %b = load i32, i32* %1
43  %c = load i32, i32* %2
44  %d = load i32, i32* %3
45  ret void
46}
47