xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/critical-anti-dep-breaker.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic -post-RA-scheduler=1 -break-anti-dependencies=critical  | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker
3*9880d681SAndroid Build Coastguard Worker; PR20308 ( http://llvm.org/bugs/show_bug.cgi?id=20308 )
4*9880d681SAndroid Build Coastguard Worker; The critical-anti-dependency-breaker must not use register def information from a kill inst.
5*9880d681SAndroid Build Coastguard Worker; This test case expects such an instruction to appear as a comment with def info for RDI.
6*9880d681SAndroid Build Coastguard Worker; There is an anti-dependency (WAR) hazard using RAX using default reg allocation and scheduling.
7*9880d681SAndroid Build Coastguard Worker; The post-RA-scheduler and critical-anti-dependency breaker can eliminate that hazard using R10.
8*9880d681SAndroid Build Coastguard Worker; That is the first free register that isn't used as a param in the call to "@Image".
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker@PartClass = external global i32
11*9880d681SAndroid Build Coastguard Worker@NullToken = external global i64
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: Part_Create:
14*9880d681SAndroid Build Coastguard Worker; CHECK: movq PartClass@GOTPCREL(%rip), %r10
15*9880d681SAndroid Build Coastguard Workerdefine i32 @Part_Create(i64* %Anchor, i32 %TypeNum, i32 %F, i32 %Z, i32* %Status, i64* %PartTkn) {
16*9880d681SAndroid Build Coastguard Worker  %PartObj = alloca i64*, align 8
17*9880d681SAndroid Build Coastguard Worker  %Vchunk = alloca i64, align 8
18*9880d681SAndroid Build Coastguard Worker  %1 = load i64, i64* @NullToken, align 4
19*9880d681SAndroid Build Coastguard Worker  store i64 %1, i64* %Vchunk, align 8
20*9880d681SAndroid Build Coastguard Worker  %2 = load i32, i32* @PartClass, align 4
21*9880d681SAndroid Build Coastguard Worker  call i32 @Image(i64* %Anchor, i32 %2, i32 0, i32 0, i32* %Status, i64* %PartTkn, i64** %PartObj)
22*9880d681SAndroid Build Coastguard Worker  call i32 @Create(i64* %Anchor)
23*9880d681SAndroid Build Coastguard Worker  ret i32 %2
24*9880d681SAndroid Build Coastguard Worker}
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Workerdeclare i32 @Image(i64*, i32, i32, i32, i32*, i64*, i64**)
27*9880d681SAndroid Build Coastguard Workerdeclare i32 @Create(i64*)
28