1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-apple-darwin | FileCheck %s
4 ; This command line used to crash due to dangling nodes left after PreprocessISelDAG
5 ; RUN: llc < %s -mtriple=x86_64-apple-darwin -pre-RA-sched=linearize | FileCheck %s --check-prefix=pre-RA
7 %"struct.clang::Action" = type { %"struct.clang::ActionBase" }
8 %"struct.clang::ActionBase" = type { ptr }
9 %"struct.clang::ActionBase::ActionResult<0u>" = type { ptr, i8 }
10 @NumTrials = internal global i32 10000000 ; <ptr> [#uses=2]
11 @llvm.used = appending global [1 x ptr] [ ptr @_Z25RawPointerPerformanceTestPvRN5clang6ActionE ], section "llvm.metadata" ; <ptr> [#uses=0]
13 define void @_Z25RawPointerPerformanceTestPvRN5clang6ActionE(ptr %Val, ptr %Actions) nounwind {
14 ; CHECK-LABEL: _Z25RawPointerPerformanceTestPvRN5clang6ActionE:
15 ; CHECK: ## %bb.0: ## %entry
16 ; CHECK-NEXT: cmpl $0, _NumTrials(%rip)
17 ; CHECK-NEXT: je LBB0_4
18 ; CHECK-NEXT: ## %bb.1: ## %bb.nph
19 ; CHECK-NEXT: pushq %rbp
20 ; CHECK-NEXT: pushq %rbx
21 ; CHECK-NEXT: subq $24, %rsp
22 ; CHECK-NEXT: movq %rsi, %rbx
23 ; CHECK-NEXT: movq %rdi, %rax
24 ; CHECK-NEXT: xorl %ebp, %ebp
25 ; CHECK-NEXT: .p2align 4, 0x90
26 ; CHECK-NEXT: LBB0_2: ## %bb
27 ; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1
28 ; CHECK-NEXT: movq (%rbx), %rcx
29 ; CHECK-NEXT: movq %rbx, %rdi
30 ; CHECK-NEXT: movq %rax, %rsi
31 ; CHECK-NEXT: callq *560(%rcx)
32 ; CHECK-NEXT: movq %rax, {{[0-9]+}}(%rsp)
33 ; CHECK-NEXT: movq %rdx, {{[0-9]+}}(%rsp)
34 ; CHECK-NEXT: incl %ebp
35 ; CHECK-NEXT: cmpl _NumTrials(%rip), %ebp
36 ; CHECK-NEXT: jb LBB0_2
37 ; CHECK-NEXT: ## %bb.3:
38 ; CHECK-NEXT: addq $24, %rsp
39 ; CHECK-NEXT: popq %rbx
40 ; CHECK-NEXT: popq %rbp
41 ; CHECK-NEXT: LBB0_4: ## %return
44 ; pre-RA-LABEL: _Z25RawPointerPerformanceTestPvRN5clang6ActionE:
45 ; pre-RA: ## %bb.0: ## %entry
46 ; pre-RA-NEXT: cmpl $0, _NumTrials(%rip)
47 ; pre-RA-NEXT: je LBB0_4
48 ; pre-RA-NEXT: ## %bb.1: ## %bb.nph
49 ; pre-RA-NEXT: pushq %rbp
50 ; pre-RA-NEXT: pushq %rbx
51 ; pre-RA-NEXT: subq $24, %rsp
52 ; pre-RA-NEXT: movq %rsi, %rbx
53 ; pre-RA-NEXT: movq %rdi, %rax
54 ; pre-RA-NEXT: xorl %ebp, %ebp
55 ; pre-RA-NEXT: .p2align 4, 0x90
56 ; pre-RA-NEXT: LBB0_2: ## %bb
57 ; pre-RA-NEXT: ## =>This Inner Loop Header: Depth=1
58 ; pre-RA-NEXT: movq (%rbx), %rcx
59 ; pre-RA-NEXT: movq %rbx, %rdi
60 ; pre-RA-NEXT: movq %rax, %rsi
61 ; pre-RA-NEXT: callq *560(%rcx)
62 ; pre-RA-NEXT: incl %ebp
63 ; pre-RA-NEXT: movq %rax, {{[0-9]+}}(%rsp)
64 ; pre-RA-NEXT: movq %rdx, {{[0-9]+}}(%rsp)
65 ; pre-RA-NEXT: cmpl _NumTrials(%rip), %ebp
66 ; pre-RA-NEXT: jb LBB0_2
67 ; pre-RA-NEXT: ## %bb.3:
68 ; pre-RA-NEXT: addq $24, %rsp
69 ; pre-RA-NEXT: popq %rbx
70 ; pre-RA-NEXT: popq %rbp
71 ; pre-RA-NEXT: LBB0_4: ## %return
74 %i = alloca %"struct.clang::ActionBase::ActionResult<0u>", align 8
75 %i1 = load i32, ptr @NumTrials, align 4
76 %i2 = icmp eq i32 %i1, 0
77 br i1 %i2, label %return, label %bb.nph
79 bb.nph: ; preds = %entry
80 %mrv_gep1 = getelementptr %"struct.clang::ActionBase::ActionResult<0u>", ptr %i, i64 0, i32 1
83 bb: ; preds = %bb, %bb.nph
84 %Trial.01 = phi i32 [ 0, %bb.nph ], [ %i12, %bb ]
85 %Val_addr.02 = phi ptr [ %Val, %bb.nph ], [ %i11, %bb ]
86 %i6 = load ptr, ptr %Actions, align 8
87 %i7 = getelementptr ptr, ptr %i6, i64 70
88 %i8 = load ptr, ptr %i7, align 8
89 %i10 = call { i64, i64 } %i8(ptr %Actions, ptr %Val_addr.02) #0
90 %mrv_gr = extractvalue { i64, i64 } %i10, 0
91 store i64 %mrv_gr, ptr %i, align 4
92 %mrv_gr2 = extractvalue { i64, i64 } %i10, 1
93 store i64 %mrv_gr2, ptr %mrv_gep1, align 4
94 %i11 = load ptr, ptr %i, align 8
95 %i12 = add i32 %Trial.01, 1
96 %i13 = load i32, ptr @NumTrials, align 4
97 %i14 = icmp ult i32 %i12, %i13
98 br i1 %i14, label %bb, label %return
100 return: ; preds = %bb, %entry