xref: /llvm-project/llvm/test/CodeGen/X86/phi-bit-propagation.ll (revision 2f448bf509432c1a19ec46ab8cbc7353c03c6280)
1; RUN: llc < %s -mtriple=x86_64-- | FileCheck %s
2
3%"class.std::bitset" = type { [8 x i8] }
4
5define zeroext i1 @_Z3fooPjmS_mRSt6bitsetILm32EE(ptr nocapture %a, i64 %asize, ptr nocapture %b, i64 %bsize, ptr %bits) nounwind readonly ssp noredzone {
6entry:
7  br label %for.cond
8
9for.cond:                                         ; preds = %for.inc, %entry
10  %0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ]
11  %conv = zext i32 %0 to i64
12  %cmp = icmp eq i64 %conv, %bsize
13  br i1 %cmp, label %return, label %for.body
14
15for.body:                                         ; preds = %for.cond
16  %arrayidx = getelementptr inbounds i32, ptr %b, i64 %conv
17  %tmp5 = load i32, ptr %arrayidx, align 4
18  %conv6 = zext i32 %tmp5 to i64
19  %rem.i.i.i.i = and i64 %conv6, 63
20  %tmp3.i = load i64, ptr %bits, align 8
21  %shl.i.i = shl i64 1, %rem.i.i.i.i
22  %and.i = and i64 %shl.i.i, %tmp3.i
23  %cmp.i = icmp eq i64 %and.i, 0
24  br i1 %cmp.i, label %for.inc, label %return
25
26for.inc:                                          ; preds = %for.body
27  %inc = add i32 %0, 1
28  br label %for.cond
29
30return:                                           ; preds = %for.body, %for.cond
31; CHECK-NOT: and
32  %retval.0 = phi i1 [ true, %for.body ], [ false, %for.cond ]
33  ret i1 %retval.0
34}
35
36; This test case caused an assertion failure; see PR9324.
37define void @func_37() noreturn nounwind ssp {
38entry:
39  br i1 undef, label %lbl_919, label %entry.for.inc_crit_edge
40
41entry.for.inc_crit_edge:                          ; preds = %entry
42  br label %for.inc
43
44lbl_919:                                          ; preds = %for.cond7.preheader, %entry
45  br label %for.cond7.preheader
46
47for.cond7.preheader:                              ; preds = %for.inc, %lbl_919
48  %storemerge.ph = phi i8 [ 0, %lbl_919 ], [ %add, %for.inc ]
49  br i1 undef, label %for.inc, label %lbl_919
50
51for.inc:                                          ; preds = %for.cond7.preheader, %entry.for.inc_crit_edge
52  %add = add i8 undef, 1
53  br label %for.cond7.preheader
54}
55