1 ; REQUIRES: x86_64-linux
2 ; RUN: opt < %s -codegenprepare -mtriple=x86_64 -S -o %t
3 ; RUN: FileCheck %s < %t --check-prefix=IR
4 ; RUN: llc -mtriple=x86_64-- -stop-after=finalize-isel %t -o - | FileCheck %s --check-prefix=MIR
6 define internal i32 @arc_compare(i1 %c) {
8 %0 = load i64, ptr undef, align 8
9 br i1 %c, label %return, label %if.end
11 if.end: ; preds = %entry
12 ;; Check pseudo probes are next to each other at the beginning of this block.
14 ; IR: call void @llvm.pseudoprobe(i64 5116412291814990879, i64 1, i32 0, i64 -1)
15 ; IR: call void @llvm.pseudoprobe(i64 5116412291814990879, i64 3, i32 0, i64 -1)
16 call void @llvm.pseudoprobe(i64 5116412291814990879, i64 1, i32 0, i64 -1)
17 %1 = load i16, ptr undef, align 8
18 call void @llvm.pseudoprobe(i64 5116412291814990879, i64 3, i32 0, i64 -1)
20 %3 = icmp eq i16 %2, 0
21 ;; Check the load-and-cmp sequence is fold into a test instruction.
22 ; MIR-label: bb.1.if.end
23 ; MIR: %[[#REG:]]:gr64 = IMPLICIT_DEF
24 ; MIR: TEST8mi killed %[[#REG]], 1, $noreg, 0, $noreg, 16
26 br i1 %3, label %return, label %if.end6
28 if.end6: ; preds = %if.end
29 call void @llvm.pseudoprobe(i64 5116412291814990879, i64 5, i32 0, i64 -1)
32 return: ; preds = %if.end6, %if.end, %entry
36 ; Function Attrs: inaccessiblememonly nounwind willreturn
37 declare void @llvm.pseudoprobe(i64, i64, i32, i64) #0
39 attributes #0 = { inaccessiblememonly nounwind willreturn }