1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s 3 ; PR7814 4 5 @g_16 = global i64 -3738643449681751625, align 8 6 @g_38 = global i32 0, align 4 7 @.str = private constant [4 x i8] c"%d\0A\00" 8 9 define i32 @main() nounwind { 10 ; CHECK-LABEL: main: 11 ; CHECK: # %bb.0: # %entry 12 ; CHECK-NEXT: xorl %eax, %eax 13 ; CHECK-NEXT: cmpq {{.*}}(%rip), %rax 14 ; CHECK-NEXT: sbbl %eax, %eax 15 ; CHECK-NEXT: andl $150, %eax 16 ; CHECK-NEXT: testb %al, %al 17 ; CHECK-NEXT: jle .LBB0_1 18 ; CHECK-NEXT: # %bb.2: # %if.then 19 ; CHECK-NEXT: movl $1, {{.*}}(%rip) 20 ; CHECK-NEXT: movl $1, %esi 21 ; CHECK-NEXT: jmp .LBB0_3 22 ; CHECK-NEXT: .LBB0_1: # %entry.if.end_crit_edge 23 ; CHECK-NEXT: movl {{.*}}(%rip), %esi 24 ; CHECK-NEXT: .LBB0_3: # %if.end 25 ; CHECK-NEXT: pushq %rax 26 ; CHECK-NEXT: movl $.L.str, %edi 27 ; CHECK-NEXT: xorl %eax, %eax 28 ; CHECK-NEXT: callq printf 29 ; CHECK-NEXT: xorl %eax, %eax 30 ; CHECK-NEXT: popq %rcx 31 ; CHECK-NEXT: retq 32 entry: 33 %tmp = load i64, i64* @g_16 34 %not.lnot = icmp ne i64 %tmp, 0 35 %conv = sext i1 %not.lnot to i64 36 %and = and i64 %conv, 150 37 %conv.i = trunc i64 %and to i8 38 %cmp = icmp sgt i8 %conv.i, 0 39 br i1 %cmp, label %if.then, label %entry.if.end_crit_edge 40 41 entry.if.end_crit_edge: 42 %tmp4.pre = load i32, i32* @g_38 43 br label %if.end 44 45 if.then: 46 store i32 1, i32* @g_38 47 br label %if.end 48 49 if.end: 50 %tmp4 = phi i32 [ %tmp4.pre, %entry.if.end_crit_edge ], [ 1, %if.then ] ; <i32> [#uses=1] 51 %call5 = tail call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %tmp4) nounwind ; <i32> [#uses=0] 52 ret i32 0 53 } 54 55 declare i32 @printf(i8* nocapture, ...) nounwind 56 57