1 ; RUN: llc %s -o - -enable-shrink-wrap=true | FileCheck %s --check-prefix=CHECK --check-prefix=ENABLE
2 ; RUN: llc %s -o - -enable-shrink-wrap=false | FileCheck %s --check-prefix=CHECK --check-prefix=DISABLE
3 target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
4 target triple = "i686-pc-windows-msvc18.0.0"
6 %struct.S = type { i32 }
8 ; Check that we do not use a basic block that has EFLAGS as live-in
9 ; if we need to realign the stack.
11 ; CHECK-LABEL: stackRealignment:
14 ; Make sure we actually perform some stack realignment.
15 ; CHECK: andl ${{[-0-9]+}}, %esp
16 ; This is the end of the entry block.
17 ; The prologue should have happened before that point because past
18 ; this point, EFLAGS is live.
20 define x86_thiscallcc void @stackRealignment(%struct.S* %this) {
22 %data = alloca [1 x i32], align 4
23 %d = alloca double, align 8
24 %tmp = bitcast [1 x i32]* %data to i8*
25 %arrayinit.begin = getelementptr inbounds [1 x i32], [1 x i32]* %data, i32 0, i32 0
26 %x_ = getelementptr inbounds %struct.S, %struct.S* %this, i32 0, i32 0
27 %tmp1 = load i32, i32* %x_, align 4
28 %cmp = icmp sgt i32 %tmp1, 32
29 %cond = select i1 %cmp, i32 42, i32 128
30 store i32 %cond, i32* %arrayinit.begin, align 4
31 %cmp3 = icmp slt i32 %tmp1, 32
32 br i1 %cmp3, label %cleanup, label %if.end
34 if.end: ; preds = %entry
35 %tmp2 = bitcast double* %d to i8*
36 call x86_thiscallcc void @bar(%struct.S* nonnull %this, i32* %arrayinit.begin, double* nonnull %d)
39 cleanup: ; preds = %if.end, %entry
43 ; Function Attrs: optsize
44 declare x86_thiscallcc void @bar(%struct.S*, i32*, double*)