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 { i32 (...)** }
9 %"struct.clang::ActionBase::ActionResult<0u>" = type { i8*, i8 }
10 @NumTrials = internal global i32 10000000 ; <i32*> [#uses=2]
11 @llvm.used = appending global [1 x i8*] [ i8* bitcast (void (i8*, %"struct.clang::Action"*)* @_Z25RawPointerPerformanceTestPvRN5clang6ActionE to i8*) ], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0]
13 define void @_Z25RawPointerPerformanceTestPvRN5clang6ActionE(i8* %Val, %"struct.clang::Action"* %Actions) nounwind {
14 ; CHECK-LABEL: _Z25RawPointerPerformanceTestPvRN5clang6ActionE:
15 ; CHECK: ## %bb.0: ## %entry
16 ; CHECK-NEXT: pushq %rbp
17 ; CHECK-NEXT: pushq %rbx
18 ; CHECK-NEXT: subq $24, %rsp
19 ; CHECK-NEXT: cmpl $0, _NumTrials(%rip)
20 ; CHECK-NEXT: je LBB0_3
21 ; CHECK-NEXT: ## %bb.1: ## %bb.nph
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: LBB0_3: ## %return
38 ; CHECK-NEXT: addq $24, %rsp
39 ; CHECK-NEXT: popq %rbx
40 ; CHECK-NEXT: popq %rbp
43 ; pre-RA-LABEL: _Z25RawPointerPerformanceTestPvRN5clang6ActionE:
44 ; pre-RA: ## %bb.0: ## %entry
45 ; pre-RA-NEXT: pushq %rbp
46 ; pre-RA-NEXT: pushq %rbx
47 ; pre-RA-NEXT: subq $24, %rsp
48 ; pre-RA-NEXT: cmpl $0, _NumTrials(%rip)
49 ; pre-RA-NEXT: je LBB0_3
50 ; pre-RA-NEXT: ## %bb.1: ## %bb.nph
51 ; pre-RA-NEXT: movq %rsi, %rbx
52 ; pre-RA-NEXT: movq %rdi, %rax
53 ; pre-RA-NEXT: xorl %ebp, %ebp
54 ; pre-RA-NEXT: .p2align 4, 0x90
55 ; pre-RA-NEXT: LBB0_2: ## %bb
56 ; pre-RA-NEXT: ## =>This Inner Loop Header: Depth=1
57 ; pre-RA-NEXT: movq (%rbx), %rcx
58 ; pre-RA-NEXT: movq %rbx, %rdi
59 ; pre-RA-NEXT: movq %rax, %rsi
60 ; pre-RA-NEXT: callq *560(%rcx)
61 ; pre-RA-NEXT: incl %ebp
62 ; pre-RA-NEXT: movq %rax, {{[0-9]+}}(%rsp)
63 ; pre-RA-NEXT: movq %rdx, {{[0-9]+}}(%rsp)
64 ; pre-RA-NEXT: cmpl _NumTrials(%rip), %ebp
65 ; pre-RA-NEXT: jb LBB0_2
66 ; pre-RA-NEXT: LBB0_3: ## %return
67 ; pre-RA-NEXT: addq $24, %rsp
68 ; pre-RA-NEXT: popq %rbx
69 ; pre-RA-NEXT: popq %rbp
72 %0 = alloca %"struct.clang::ActionBase::ActionResult<0u>", align 8 ; <%"struct.clang::ActionBase::ActionResult<0u>"*> [#uses=3]
73 %1 = load i32, i32* @NumTrials, align 4 ; <i32> [#uses=1]
74 %2 = icmp eq i32 %1, 0 ; <i1> [#uses=1]
75 br i1 %2, label %return, label %bb.nph
77 bb.nph: ; preds = %entry
78 %3 = getelementptr %"struct.clang::Action", %"struct.clang::Action"* %Actions, i64 0, i32 0, i32 0 ; <i32 (...)***> [#uses=1]
79 %mrv_gep = bitcast %"struct.clang::ActionBase::ActionResult<0u>"* %0 to i64* ; <i64*> [#uses=1]
80 %mrv_gep1 = getelementptr %"struct.clang::ActionBase::ActionResult<0u>", %"struct.clang::ActionBase::ActionResult<0u>"* %0, i64 0, i32 1 ; <i8*> [#uses=1]
81 %4 = bitcast i8* %mrv_gep1 to i64* ; <i64*> [#uses=1]
82 %5 = getelementptr %"struct.clang::ActionBase::ActionResult<0u>", %"struct.clang::ActionBase::ActionResult<0u>"* %0, i64 0, i32 0 ; <i8**> [#uses=1]
85 bb: ; preds = %bb, %bb.nph
86 %Trial.01 = phi i32 [ 0, %bb.nph ], [ %12, %bb ] ; <i32> [#uses=1]
87 %Val_addr.02 = phi i8* [ %Val, %bb.nph ], [ %11, %bb ] ; <i8*> [#uses=1]
88 %6 = load i32 (...)**, i32 (...)*** %3, align 8 ; <i32 (...)**> [#uses=1]
89 %7 = getelementptr i32 (...)*, i32 (...)** %6, i64 70 ; <i32 (...)**> [#uses=1]
90 %8 = load i32 (...)*, i32 (...)** %7, align 8 ; <i32 (...)*> [#uses=1]
91 %9 = bitcast i32 (...)* %8 to { i64, i64 } (%"struct.clang::Action"*, i8*)* ; <{ i64, i64 } (%"struct.clang::Action"*, i8*)*> [#uses=1]
92 %10 = call { i64, i64 } %9(%"struct.clang::Action"* %Actions, i8* %Val_addr.02) nounwind ; <{ i64, i64 }> [#uses=2]
93 %mrv_gr = extractvalue { i64, i64 } %10, 0 ; <i64> [#uses=1]
94 store i64 %mrv_gr, i64* %mrv_gep
95 %mrv_gr2 = extractvalue { i64, i64 } %10, 1 ; <i64> [#uses=1]
96 store i64 %mrv_gr2, i64* %4
97 %11 = load i8*, i8** %5, align 8 ; <i8*> [#uses=1]
98 %12 = add i32 %Trial.01, 1 ; <i32> [#uses=2]
99 %13 = load i32, i32* @NumTrials, align 4 ; <i32> [#uses=1]
100 %14 = icmp ult i32 %12, %13 ; <i1> [#uses=1]
101 br i1 %14, label %bb, label %return
103 return: ; preds = %bb, %entry