1 ; RUN: llc -O3 -o - %s | FileCheck %s
2 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
3 target triple = "x86_64-unknown-linux-gnu"
5 ; Function Attrs: uwtable
6 ; When tail-duplicating during placement, we work backward from blocks with
7 ; multiple successors. In this case, the block dup1 gets duplicated into dup2
8 ; and if.then64, and then the block dup2 gets duplicated into land.lhs.true
10 ; CHECK-LABEL: repeated_tail_dup:
11 define void @repeated_tail_dup(i1 %a1, i1 %a2, i32* %a4, i32* %a5, i8* %a6) #0 align 2 {
15 ; CHECK: {{^}}.[[HEADER:LBB0_[1-9]]]: # %for.cond
16 for.cond: ; preds = %dup1, %entry
17 br i1 %a1, label %land.lhs.true, label %if.end56
19 land.lhs.true: ; preds = %for.cond
20 store i32 10, i32* %a4, align 8
23 if.end56: ; preds = %for.cond
24 br i1 %a2, label %if.then64, label %if.end70
26 if.then64: ; preds = %if.end56
27 store i8 1, i8* %a6, align 1
31 ; CHECK-NEXT: # in Loop:
32 ; CHECK-NEXT: movl $12, (%rdx)
33 ; CHECK-NEXT: movl $2, (%rcx)
34 ; CHECK-NEXT: testl %eax, %eax
35 ; CHECK-NEXT: je .[[HEADER]]
36 if.end70: ; preds = %if.end56
37 store i32 12, i32* %a4, align 8
40 dup2: ; preds = %if.end70, %land.lhs.true
41 store i32 2, i32* %a5, align 4
44 dup1: ; preds = %dup2, %if.then64
45 %val = load i32, i32* %a4, align 8
46 %switch = icmp ult i32 undef, 1
47 br i1 %switch, label %for.cond, label %for.end
49 for.end: ; preds = %dup1
53 attributes #0 = { uwtable }