[X86] Don't pass a scale value of 0 to scatter/gather intrinsics. This causes the...
[oota-llvm.git] / test / CodeGen / X86 / late-address-taken.ll
1 ; RUN: llc -mtriple=x86_64-pc-windows-msvc < %s | FileCheck %s
2
3 ; Repro cases from PR25168
4
5 ; test @catchret - catchret target is not address-taken until PEI
6 ; splits it into lea/mov followed by ret.  Make sure the MBB is
7 ; handled, both by tempting BranchFolding to merge it with %early_out
8 ; and delete it, and by checking that we emit a proper reference
9 ; to it in the LEA
10
11 declare void @ProcessCLRException()
12 declare void @f()
13
14 define void @catchret(i1 %b) personality void ()* @ProcessCLRException {
15 entry:
16   br i1 %b, label %body, label %early_out
17 early_out:
18   ret void
19 body:
20   invoke void @f()
21           to label %exit unwind label %catch.pad
22 catch.pad:
23   %catch = catchpad [i32 33554467]
24           to label %catch.body unwind label %catch.end
25 catch.body:
26   catchret %catch to label %exit
27 catch.end:
28   catchendpad unwind to caller
29 exit:
30   ret void
31 }
32 ; CHECK-LABEL: catchret:  # @catchret
33 ; CHECK: [[Exit:^[^ :]+]]: # Block address taken
34 ; CHECK-NEXT:              # %exit
35 ; CHECK: # %catch.pad
36 ; CHECK: .seh_endprolog
37 ; CHECK: leaq [[Exit]](%rip), %rax
38 ; CHECK: retq # CATCHRET
39
40
41 ; test @setjmp - similar to @catchret, but the MBB in question
42 ; is the one generated when the setjmp's block is split
43
44 @buf = internal global [5 x i8*] zeroinitializer
45 declare i8* @llvm.frameaddress(i32) nounwind readnone
46 declare i8* @llvm.stacksave() nounwind
47 declare i32 @llvm.eh.sjlj.setjmp(i8*) nounwind
48 declare void @llvm.eh.sjlj.longjmp(i8*) nounwind
49
50 define void @setjmp(i1 %b) nounwind {
51 entry:
52   br i1 %b, label %early_out, label %sj
53 early_out:
54   ret void
55 sj:
56   %fp = call i8* @llvm.frameaddress(i32 0)
57   store i8* %fp, i8** getelementptr inbounds ([5 x i8*], [5 x i8*]* @buf, i64 0, i64 0), align 16
58   %sp = call i8* @llvm.stacksave()
59   store i8* %sp, i8** getelementptr inbounds ([5 x i8*], [5 x i8*]* @buf, i64 0, i64 2), align 16
60   call i32 @llvm.eh.sjlj.setjmp(i8* bitcast ([5 x i8*]* @buf to i8*))
61   ret void
62 }
63 ; CHECK-LABEL: setjmp: # @setjmp
64 ; CHECK: # %sj
65 ; CHECK: leaq [[Label:\..+]](%rip), %[[Reg:.+]]{{$}}
66 ; CHECK-NEXT: movq %[[Reg]], buf
67 ; CHECK: {{^}}[[Label]]:  # Block address taken
68 ; CHECK-NEXT:              # %sj