• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-- | FileCheck %s
3; PR964
4
5define i8* @FindChar(i8* %CurPtr) {
6; CHECK-LABEL: FindChar:
7; CHECK:       # %bb.0: # %entry
8; CHECK-NEXT:    pushl %edi
9; CHECK-NEXT:    .cfi_def_cfa_offset 8
10; CHECK-NEXT:    pushl %esi
11; CHECK-NEXT:    .cfi_def_cfa_offset 12
12; CHECK-NEXT:    .cfi_offset %esi, -12
13; CHECK-NEXT:    .cfi_offset %edi, -8
14; CHECK-NEXT:    xorl %edi, %edi
15; CHECK-NEXT:    movl {{[0-9]+}}(%esp), %esi
16; CHECK-NEXT:    .p2align 4, 0x90
17; CHECK-NEXT:  .LBB0_1: # %bb
18; CHECK-NEXT:    # =>This Inner Loop Header: Depth=1
19; CHECK-NEXT:    movzbl (%esi,%edi), %eax
20; CHECK-NEXT:    incl %edi
21; CHECK-NEXT:    cmpb $120, %al
22; CHECK-NEXT:    je .LBB0_3
23; CHECK-NEXT:  # %bb.2: # %bb
24; CHECK-NEXT:    # in Loop: Header=BB0_1 Depth=1
25; CHECK-NEXT:    testb %al, %al
26; CHECK-NEXT:    jne .LBB0_1
27; CHECK-NEXT:  .LBB0_3: # %bb7
28; CHECK-NEXT:    movzbl %al, %eax
29; CHECK-NEXT:    pushl %eax
30; CHECK-NEXT:    .cfi_adjust_cfa_offset 4
31; CHECK-NEXT:    calll foo
32; CHECK-NEXT:    addl $4, %esp
33; CHECK-NEXT:    .cfi_adjust_cfa_offset -4
34; CHECK-NEXT:    addl %edi, %esi
35; CHECK-NEXT:    movl %esi, %eax
36; CHECK-NEXT:    popl %esi
37; CHECK-NEXT:    .cfi_def_cfa_offset 8
38; CHECK-NEXT:    popl %edi
39; CHECK-NEXT:    .cfi_def_cfa_offset 4
40; CHECK-NEXT:    retl
41entry:
42        br label %bb
43
44bb:             ; preds = %bb, %entry
45        %indvar = phi i32 [ 0, %entry ], [ %indvar.next, %bb ]          ; <i32> [#uses=3]
46        %CurPtr_addr.0.rec = bitcast i32 %indvar to i32         ; <i32> [#uses=1]
47        %gep.upgrd.1 = zext i32 %indvar to i64          ; <i64> [#uses=1]
48        %CurPtr_addr.0 = getelementptr i8, i8* %CurPtr, i64 %gep.upgrd.1            ; <i8*> [#uses=1]
49        %tmp = load i8, i8* %CurPtr_addr.0          ; <i8> [#uses=3]
50        %tmp2.rec = add i32 %CurPtr_addr.0.rec, 1               ; <i32> [#uses=1]
51        %tmp2 = getelementptr i8, i8* %CurPtr, i32 %tmp2.rec                ; <i8*> [#uses=1]
52        %indvar.next = add i32 %indvar, 1               ; <i32> [#uses=1]
53        switch i8 %tmp, label %bb [
54                 i8 0, label %bb7
55                 i8 120, label %bb7
56        ]
57
58bb7:            ; preds = %bb, %bb
59        tail call void @foo( i8 %tmp )
60        ret i8* %tmp2
61}
62
63declare void @foo(i8)
64
65