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