• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: llc < %s -march=x86 -mtriple=i686-pc-win32 | FileCheck %s
2
3; PR26575
4; Assertion `(Disp->isImm() || Disp->isGlobal()) && (Other.Disp->isImm() || Other.Disp->isGlobal()) && "Address displacement operand is always an immediate or a global"' failed.
5
6target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
7target triple = "i686-pc-windows-msvc"
8
9declare void @llvm.memcpy.p0i8.p0i8.i32(i8* nocapture, i8* nocapture readonly, i32, i32, i1) argmemonly nounwind
10declare <2 x i64> @_mm_xor_si128(<2 x i64>, <2 x i64>) optsize
11declare <2 x i64> @llvm.x86.pclmulqdq(<2 x i64>, <2 x i64>, i8) nounwind readnone
12declare <4 x float> @_mm_castsi128_ps(<2 x i64>) optsize
13
14; Check that the LEA optimization pass works with CPI address displacements.
15define void @test1(i8* nocapture readonly %src, i32 %len) #0 {
16  %parts = alloca [4 x i32], align 4
17  %part0 = bitcast [4 x i32]* %parts to i8*
18  call void @llvm.memcpy.p0i8.p0i8.i32(i8* %part0, i8* %src, i32 %len, i32 1, i1 false)
19  %call0 = tail call <2 x i64> @_mm_xor_si128(<2 x i64> undef, <2 x i64> <i64 -9187201950435737472, i64 -9187201950435737472>)
20  %tmp0 = tail call <2 x i64> @llvm.x86.pclmulqdq(<2 x i64> undef, <2 x i64> <i64 7631803798, i64 5708721108>, i8 16)
21  %call1 = tail call <4 x float> @_mm_castsi128_ps(<2 x i64> %tmp0)
22  ret void
23; CHECK-LABEL: test1:
24; CHECK:	leal{{.*}}
25; CHECK:	calll _memcpy
26; CHECK:	movaps __xmm@{{[0-9a-f]+}}, %xmm1
27; CHECK:	calll __mm_xor_si128
28; CHECK:	pclmulqdq $16, __xmm@{{[0-9a-f]+}}, %xmm0
29; CHECK:	jmp __mm_castsi128_ps
30}
31
32declare i32 @GetLastError(...)
33declare void @IsolationAwareDeactivateActCtx(i32, i32)
34declare i8* @llvm.localaddress()
35declare void @llvm.localescape(...)
36declare i8* @llvm.localrecover(i8*, i8*, i32)
37
38@IsolationAwarePrivateT_SqbjaYRiRY = common global i32 0, align 4
39
40; Check that the MCSymbol objects are created to be used in "\01?fin$0@0@test2@@".
41define void @test2() #0 {
42entry:
43  %fActivateActCtxSuccess = alloca i32, align 4
44  %proc = alloca i32, align 4
45  %ulpCookie = alloca i32, align 4
46  call void (...) @llvm.localescape(i32* nonnull %fActivateActCtxSuccess, i32* nonnull %proc, i32* nonnull %ulpCookie)
47  %tmp0 = tail call i8* @llvm.localaddress()
48  call fastcc void @"\01?fin$0@0@test2@@"(i8* %tmp0)
49  ret void
50; CHECK-LABEL: test2:
51; CHECK:	Ltest2$frame_escape_0 = 8
52; CHECK:	Ltest2$frame_escape_1 = 4
53; CHECK:	Ltest2$frame_escape_2 = 0
54; CHECK:	calll "?fin$0@0@test2@@"
55}
56
57; Check that the LEA optimization pass works with MCSymbol address displacements.
58define internal fastcc void @"\01?fin$0@0@test2@@"(i8* readonly %frame_pointer) unnamed_addr noinline nounwind optsize {
59entry:
60  %tmp0 = tail call i8* @llvm.localrecover(i8* bitcast (void ()* @test2 to i8*), i8* %frame_pointer, i32 1)
61  %proc = bitcast i8* %tmp0 to i32*
62  %tmp1 = tail call i8* @llvm.localrecover(i8* bitcast (void ()* @test2 to i8*), i8* %frame_pointer, i32 2)
63  %ulpCookie = bitcast i8* %tmp1 to i32*
64  %tmp2 = load i32, i32* @IsolationAwarePrivateT_SqbjaYRiRY, align 4
65  %tobool = icmp eq i32 %tmp2, 0
66  br i1 %tobool, label %if.end, label %land.lhs.true
67
68land.lhs.true:
69  %tmp3 = tail call i8* @llvm.localrecover(i8* bitcast (void ()* @test2 to i8*), i8* %frame_pointer, i32 0)
70  %fActivateActCtxSuccess = bitcast i8* %tmp3 to i32*
71  %tmp4 = load i32, i32* %fActivateActCtxSuccess, align 4
72  %tobool1 = icmp eq i32 %tmp4, 0
73  br i1 %tobool1, label %if.end, label %if.then
74
75if.then:
76  %tmp5 = load i32, i32* %proc, align 4
77  %tobool2 = icmp eq i32 %tmp5, 0
78  br i1 %tobool2, label %cond.end, label %cond.true
79
80cond.true:
81  %call = tail call i32 bitcast (i32 (...)* @GetLastError to i32 ()*)()
82  br label %cond.end
83
84cond.end:
85  %tmp6 = load i32, i32* %ulpCookie, align 4
86  tail call void @IsolationAwareDeactivateActCtx(i32 0, i32 %tmp6)
87  br label %if.end
88
89if.end:
90  ret void
91; CHECK-LABEL: "?fin$0@0@test2@@":
92; CHECK:	cmpl $0, Ltest2$frame_escape_0([[REG1:%[a-z]+]])
93; CHECK:	leal Ltest2$frame_escape_1([[REG1]]), [[REG2:%[a-z]+]]
94; CHECK:	leal Ltest2$frame_escape_2([[REG1]]), [[REG3:%[a-z]+]]
95; CHECK:	cmpl $0, ([[REG2]])
96; CHECK:	pushl ([[REG3]])
97}
98
99attributes #0 = { nounwind optsize "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+pclmul,+popcnt,+sse,+sse2,+sse3,+sse4.1,+sse4.2,+ssse3" "unsafe-fp-math"="false" "use-soft-float"="false" }
100