brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.6 KiB · 3c23b54 Raw
39 lines · plain
1; RUN: opt -passes='print<structural-hash>' -disable-output %s 2>&1 | FileCheck %s2; RUN: opt -passes='print<structural-hash><detailed>' -disable-output %s 2>&1 | FileCheck %s -check-prefix=DETAILED-HASH3; RUN: opt -passes='print<structural-hash><call-target-ignored>' -disable-output %s 2>&1 | FileCheck %s -check-prefix=CALLTARGETIGNORED-HASH4 5; Add a declaration so that we can test we skip it.6declare i64 @d1(i64)7declare i64 @e1(i64)8 9define i64 @f1(i64 %a) {10	%b = add i64 %a, 111	%c = call i64 @d1(i64 %b)12	ret i64 %c13}14 15define i64 @f2(i64 %a) {16	%b = add i64 %a, 117	%c = call i64 @e1(i64 %b)18	ret i64 %c19}20 21; CHECK: Module Hash: {{([a-f0-9]{16,})}}22; CHECK-NEXT: Function f1 Hash: [[F1H:([a-f0-9]{16,})]]23; CHECK-NEXT: Function f2 Hash: [[F1H]]24 25; DETAILED-HASH: Module Hash: {{([a-f0-9]{16,})}}26; DETAILED-HASH-NEXT: Function f1 Hash: [[DF1H:([a-f0-9]{16,})]]27; DETAILED-HASH-NOT: [[DF1H]]28; DETAILED-HASH-NEXT: Function f2 Hash: {{([a-f0-9]{16,})}}29 30; When ignoring the call target, check if `f1` and `f2` produce the same function hash.31; The index for the call instruction is 1, and the index of the call target operand is 1.32; The ignored operand hashes for different call targets should be different.33; CALLTARGETIGNORED-HASH: Module Hash: {{([a-f0-9]{16,})}}34; CALLTARGETIGNORED-HASH-NEXT: Function f1 Hash: [[IF1H:([a-f0-9]{16,})]]35; CALLTARGETIGNORED-HASH-NEXT:   Ignored Operand Hash: [[IO1H:([a-f0-9]{16,})]] at (1,1)36; CALLTARGETIGNORED-HASH-NEXT: Function f2 Hash: [[IF1H]]37; CALLTARGETIGNORED-HASH-NOT: [[IO1H]]38; CALLTARGETIGNORED-HASH-NEXT:   Ignored Operand Hash: {{([a-f0-9]{16,})}} at (1,1)39