summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/tail-dup-repeat.ll
blob: 21b48e16efb9eaf44c9159ab698f2e1c0d221d98 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
; RUN: llc -O2 -tail-dup-placement-threshold=4 -o - %s | FileCheck %s
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

; Function Attrs: uwtable
; When tail-duplicating during placement, we work backward from blocks with
; multiple successors. In this case, the block dup1 gets duplicated into dup2
; and if.then64, and then the block dup2 gets duplicated into land.lhs.true
; and if.end70
; CHECK-LABEL: repeated_tail_dup:
define void @repeated_tail_dup(i1 %a1, i1 %a2, i32* %a4, i32* %a5, i8* %a6) #0 align 2 {
entry:
  br label %for.cond

; CHECK: {{^}}.[[HEADER:LBB0_[1-9]]]: # %for.cond
for.cond:                                         ; preds = %dup1, %entry
  br i1 %a1, label %land.lhs.true, label %if.end56

land.lhs.true:                                    ; preds = %for.cond
  store i32 10, i32* %a4, align 8
  br label %dup2

if.end56:                                         ; preds = %for.cond
  br i1 %a2, label %if.then64, label %if.end70

if.then64:                                        ; preds = %if.end56
  store i8 1, i8* %a6, align 1
  br label %dup1

; CHECK:      # %if.end70
; CHECK-NEXT: # in Loop:
; CHECK-NEXT: movl $12, (%rdx)
; CHECK-NEXT: movl $2, (%rcx)
; CHECK-NEXT: testl %eax, %eax
; CHECK-NEXT: je .[[HEADER]]
if.end70:                                         ; preds = %if.end56
  store i32 12, i32* %a4, align 8
  br label %dup2

dup2:                                             ; preds = %if.end70, %land.lhs.true
  store i32 2, i32* %a5, align 4
  br label %dup1

dup1:                                             ; preds = %dup2, %if.then64
  %val = load i32, i32* %a4, align 8
  %switch = icmp ult i32 undef, 1
  br i1 %switch, label %for.cond, label %for.end

for.end:                                          ; preds = %dup1
  ret void
}

attributes #0 = { uwtable }
OpenPOWER on IntegriCloud