1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 3
2 ; RUN: llc < %s -mtriple=x86_64-pc-linux-gnu | FileCheck %s
4 ; Correctly tracking COPY instructions in peephole should not crash compiler.
6 declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture)
8 define void @foo(ptr %p1, ptr %p2, ptr %p3, ptr %p4) {
10 ; CHECK: # %bb.0: # %entry
11 ; CHECK-NEXT: movq %rcx, %rax
12 ; CHECK-NEXT: movl $5, -{{[0-9]+}}(%rsp)
13 ; CHECK-NEXT: movl $5, %r8d
14 ; CHECK-NEXT: xorl %ecx, %ecx
15 ; CHECK-NEXT: cmpl $0, (%rdi)
16 ; CHECK-NEXT: setle %cl
17 ; CHECK-NEXT: movl (%rax), %eax
18 ; CHECK-NEXT: shll %cl, %eax
19 ; CHECK-NEXT: movl %r8d, (%rdx)
20 ; CHECK-NEXT: .p2align 4
21 ; CHECK-NEXT: .LBB0_1: # %loop2.header
22 ; CHECK-NEXT: # =>This Inner Loop Header: Depth=1
23 ; CHECK-NEXT: movl $5, %edi
24 ; CHECK-NEXT: orl %eax, %edi
25 ; CHECK-NEXT: je .LBB0_1
26 ; CHECK-NEXT: # %bb.2: # %exit
27 ; CHECK-NEXT: movl %r8d, (%rdx)
28 ; CHECK-NEXT: movl %ecx, (%rsi)
31 %q = alloca i32, align 4
32 %r = alloca i32, align 4
33 store i32 5, ptr %q, align 4
34 call void @llvm.lifetime.start.p0(i64 4, ptr %r)
35 %vq1 = load i32, ptr %q, align 4
36 %vb = load i32, ptr %p1, align 4
37 %cmp3 = icmp slt i32 %vb, 1
38 %conv4 = zext i1 %cmp3 to i32
39 %va = load i32, ptr %p4, align 4
40 %shl5 = shl i32 %va, %conv4
41 %vq2 = load i32, ptr %q, align 4
42 %cmp = icmp slt i32 %vb, 1
43 %conv = zext i1 %cmp to i32
44 %shl = shl i32 %va, %conv
45 %vq3 = load i32, ptr %q, align 4
46 %cmp.us = icmp slt i32 %vb, 1
47 %conv.us = zext i1 %cmp.us to i32
48 %shl.us = shl i32 %va, %conv.us
49 br label %loop2.preheader
52 store i32 %vq1, ptr %p3, align 4
53 br label %loop2.header
56 %cond1 = icmp eq i32 %vq3, 0
57 br i1 %cond1, label %loop2.body, label %exit
60 %cond2 = icmp eq i32 %shl.us, 0
61 br i1 %cond2, label %loop2.header, label %exit
64 store i32 %vq2, ptr %p3, align 4
65 store i32 %conv.us, ptr %p2, align 4