xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/hoist-common.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc < %s -mtriple=x86_64-apple-macosx  | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; This is supposed to be testing BranchFolding's common
3*9880d681SAndroid Build Coastguard Worker; code hoisting logic, but has been erroneously passing due
4*9880d681SAndroid Build Coastguard Worker; to there being a redundant xorl in the entry block
5*9880d681SAndroid Build Coastguard Worker; and no common code to hoist.
6*9880d681SAndroid Build Coastguard Worker; However, now that MachineSink sinks the redundant xor
7*9880d681SAndroid Build Coastguard Worker; hoist-common looks at it and rejects it for hoisting,
8*9880d681SAndroid Build Coastguard Worker; which causes this test to fail.
9*9880d681SAndroid Build Coastguard Worker; Since it seems this test is broken, marking XFAIL for now
10*9880d681SAndroid Build Coastguard Worker; until someone decides to remove it or fix what it tests.
11*9880d681SAndroid Build Coastguard Worker; XFAIL: *
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker; Common "xorb al, al" instruction in the two successor blocks should be
14*9880d681SAndroid Build Coastguard Worker; moved to the entry block above the test + je.
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker; rdar://9145558
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Workerdefine zeroext i1 @t(i32 %c) nounwind ssp {
19*9880d681SAndroid Build Coastguard Workerentry:
20*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: t:
21*9880d681SAndroid Build Coastguard Worker; CHECK: xorl %eax, %eax
22*9880d681SAndroid Build Coastguard Worker; CHECK: test
23*9880d681SAndroid Build Coastguard Worker; CHECK: je
24*9880d681SAndroid Build Coastguard Worker  %tobool = icmp eq i32 %c, 0
25*9880d681SAndroid Build Coastguard Worker  br i1 %tobool, label %return, label %if.then
26*9880d681SAndroid Build Coastguard Worker
27*9880d681SAndroid Build Coastguard Workerif.then:
28*9880d681SAndroid Build Coastguard Worker; CHECK: callq
29*9880d681SAndroid Build Coastguard Worker  %call = tail call zeroext i1 (...) @foo() nounwind
30*9880d681SAndroid Build Coastguard Worker  br label %return
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Workerreturn:
33*9880d681SAndroid Build Coastguard Worker; CHECK: ret
34*9880d681SAndroid Build Coastguard Worker  %retval.0 = phi i1 [ %call, %if.then ], [ false, %entry ]
35*9880d681SAndroid Build Coastguard Worker  ret i1 %retval.0
36*9880d681SAndroid Build Coastguard Worker}
37*9880d681SAndroid Build Coastguard Worker
38*9880d681SAndroid Build Coastguard Workerdeclare zeroext i1 @foo(...)
39