Home | History | Annotate | Download | only in X86
      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"
      4 
      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
      9 ; and if.end70
     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 {
     12 entry:
     13   br label %for.cond
     14 
     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
     18 
     19 land.lhs.true:                                    ; preds = %for.cond
     20   store i32 10, i32* %a4, align 8
     21   br label %dup2
     22 
     23 if.end56:                                         ; preds = %for.cond
     24   br i1 %a2, label %if.then64, label %if.end70
     25 
     26 if.then64:                                        ; preds = %if.end56
     27   store i8 1, i8* %a6, align 1
     28   br label %dup1
     29 
     30 ; CHECK:      # %if.end70
     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
     38   br label %dup2
     39 
     40 dup2:                                             ; preds = %if.end70, %land.lhs.true
     41   store i32 2, i32* %a5, align 4
     42   br label %dup1
     43 
     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
     48 
     49 for.end:                                          ; preds = %dup1
     50   ret void
     51 }
     52 
     53 attributes #0 = { uwtable }
     54