135 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py2; RUN: llc %s -o - -enable-shrink-wrap=true -no-x86-call-frame-opt | FileCheck %s --check-prefix=ENABLE3; RUN: llc %s -o - -enable-shrink-wrap=false -no-x86-call-frame-opt | FileCheck %s --check-prefix=DISABLE4target datalayout = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"5target triple = "i386-apple-macosx10.5"6 7@a = common global i32 0, align 48@d = internal unnamed_addr global i1 false9@b = common global i32 0, align 410@e = common global i8 0, align 111@f = common global i8 0, align 112@c = common global i32 0, align 413@.str = private unnamed_addr constant [4 x i8] c"%d\0A\00", align 114 15 16; Check that we are clobbering the flags when they are live-in of the17; prologue block and the prologue needs to adjust the stack.18; PR25607.19 20define i32 @eflagsLiveInPrologue() #0 {21; ENABLE-LABEL: eflagsLiveInPrologue:22; ENABLE: ## %bb.0: ## %entry23; ENABLE-NEXT: movl L_a$non_lazy_ptr, %eax24; ENABLE-NEXT: cmpl $0, (%eax)25; ENABLE-NEXT: je LBB0_226; ENABLE-NEXT: ## %bb.1: ## %if.then27; ENABLE-NEXT: movb $1, _d28; ENABLE-NEXT: LBB0_2: ## %for.cond.preheader29; ENABLE-NEXT: movl L_b$non_lazy_ptr, %eax30; ENABLE-NEXT: movl (%eax), %eax31; ENABLE-NEXT: testl %eax, %eax32; ENABLE-NEXT: je LBB0_433; ENABLE-NEXT: .p2align 434; ENABLE-NEXT: LBB0_3: ## %for.body35; ENABLE-NEXT: ## =>This Inner Loop Header: Depth=136; ENABLE-NEXT: jmp LBB0_337; ENABLE-NEXT: LBB0_4: ## %for.end38; ENABLE-NEXT: pushl %esi39; ENABLE-NEXT: subl $8, %esp40; ENABLE-NEXT: xorl %edx, %edx41; ENABLE-NEXT: cmpb $0, _d42; ENABLE-NEXT: movl $6, %ecx43; ENABLE-NEXT: cmovnel %edx, %ecx44; ENABLE-NEXT: movl L_e$non_lazy_ptr, %edx45; ENABLE-NEXT: movb %cl, (%edx)46; ENABLE-NEXT: leal 1(%ecx), %esi47; ENABLE-NEXT: cltd48; ENABLE-NEXT: idivl %esi49; ENABLE-NEXT: movl L_c$non_lazy_ptr, %eax50; ENABLE-NEXT: movl %edx, (%eax)51; ENABLE-NEXT: movl %ecx, {{[0-9]+}}(%esp)52; ENABLE-NEXT: movl $L_.str, (%esp)53; ENABLE-NEXT: calll _varfunc54; ENABLE-NEXT: xorl %eax, %eax55; ENABLE-NEXT: addl $8, %esp56; ENABLE-NEXT: popl %esi57; ENABLE-NEXT: retl58;59; DISABLE-LABEL: eflagsLiveInPrologue:60; DISABLE: ## %bb.0: ## %entry61; DISABLE-NEXT: pushl %esi62; DISABLE-NEXT: subl $8, %esp63; DISABLE-NEXT: movl L_a$non_lazy_ptr, %eax64; DISABLE-NEXT: cmpl $0, (%eax)65; DISABLE-NEXT: je LBB0_266; DISABLE-NEXT: ## %bb.1: ## %if.then67; DISABLE-NEXT: movb $1, _d68; DISABLE-NEXT: LBB0_2: ## %for.cond.preheader69; DISABLE-NEXT: movl L_b$non_lazy_ptr, %eax70; DISABLE-NEXT: movl (%eax), %eax71; DISABLE-NEXT: testl %eax, %eax72; DISABLE-NEXT: je LBB0_473; DISABLE-NEXT: .p2align 474; DISABLE-NEXT: LBB0_3: ## %for.body75; DISABLE-NEXT: ## =>This Inner Loop Header: Depth=176; DISABLE-NEXT: jmp LBB0_377; DISABLE-NEXT: LBB0_4: ## %for.end78; DISABLE-NEXT: xorl %edx, %edx79; DISABLE-NEXT: cmpb $0, _d80; DISABLE-NEXT: movl $6, %ecx81; DISABLE-NEXT: cmovnel %edx, %ecx82; DISABLE-NEXT: movl L_e$non_lazy_ptr, %edx83; DISABLE-NEXT: movb %cl, (%edx)84; DISABLE-NEXT: leal 1(%ecx), %esi85; DISABLE-NEXT: cltd86; DISABLE-NEXT: idivl %esi87; DISABLE-NEXT: movl L_c$non_lazy_ptr, %eax88; DISABLE-NEXT: movl %edx, (%eax)89; DISABLE-NEXT: movl %ecx, {{[0-9]+}}(%esp)90; DISABLE-NEXT: movl $L_.str, (%esp)91; DISABLE-NEXT: calll _varfunc92; DISABLE-NEXT: xorl %eax, %eax93; DISABLE-NEXT: addl $8, %esp94; DISABLE-NEXT: popl %esi95; DISABLE-NEXT: retl96entry:97 %tmp = load i32, ptr @a, align 498 %tobool = icmp eq i32 %tmp, 099 br i1 %tobool, label %for.cond.preheader, label %if.then100 101if.then: ; preds = %entry102 store i1 true, ptr @d, align 1103 br label %for.cond.preheader104 105for.cond.preheader: ; preds = %if.then, %entry106 %tmp1 = load i32, ptr @b, align 4107 %tobool14 = icmp eq i32 %tmp1, 0108 br i1 %tobool14, label %for.end, label %for.body.preheader109 110for.body.preheader: ; preds = %for.cond.preheader111 br label %for.body112 113for.body: ; preds = %for.body, %for.body.preheader114 br label %for.body115 116for.end: ; preds = %for.cond.preheader117 %.b3 = load i1, ptr @d, align 1118 %tmp2 = select i1 %.b3, i8 0, i8 6119 store i8 %tmp2, ptr @e, align 1120 %tmp3 = load i8, ptr @e, align 1121 %conv = sext i8 %tmp3 to i32122 %add = add nsw i32 %conv, 1123 %rem = srem i32 %tmp1, %add124 store i32 %rem, ptr @c, align 4125 %conv2 = select i1 %.b3, i32 0, i32 6126 %call = tail call i32 (ptr, ...) @varfunc(ptr nonnull @.str, i32 %conv2) #1127 ret i32 0128}129 130; Function Attrs: nounwind131declare i32 @varfunc(ptr nocapture readonly, ...) #0132 133attributes #0 = { nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse" "use-soft-float"="false" }134attributes #1 = { nounwind }135