• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
3target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
4target triple = "i686-pc-windows-msvc18.0.0"
5
6%struct.S = type { i32 }
7
8; Check that we do not use a basic block that has EFLAGS as live-in
9; if we need to realign the stack.
10; PR27531.
11; CHECK-LABEL: stackRealignment:
12; Prologue code.
13; CHECK: pushl
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.
19; CHECK: jg
20define x86_thiscallcc void @stackRealignment(%struct.S* %this) {
21entry:
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
33
34if.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)
37  br label %cleanup
38
39cleanup:                                          ; preds = %if.end, %entry
40  ret void
41}
42
43; Function Attrs: optsize
44declare x86_thiscallcc void @bar(%struct.S*, i32*, double*)
45