1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py 2; RUN: llc < %s -mtriple=i386-apple-darwin | FileCheck %s 3; The inner loop should use [reg] addressing, not [reg+reg] addressing. 4; rdar://6403965 5 6target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128" 7target triple = "i386-apple-darwin9.5" 8 9define i8* @test(i8* %Q, i32* %L) nounwind { 10; CHECK-LABEL: test: 11; CHECK: ## %bb.0: ## %entry 12; CHECK-NEXT: movl {{[0-9]+}}(%esp), %eax 13; CHECK-NEXT: jmp LBB0_2 14; CHECK-NEXT: .p2align 4, 0x90 15; CHECK-NEXT: LBB0_1: ## %bb 16; CHECK-NEXT: ## in Loop: Header=BB0_2 Depth=1 17; CHECK-NEXT: incl %eax 18; CHECK-NEXT: LBB0_2: ## %bb1 19; CHECK-NEXT: ## =>This Inner Loop Header: Depth=1 20; CHECK-NEXT: movzbl (%eax), %ecx 21; CHECK-NEXT: cmpb $12, %cl 22; CHECK-NEXT: je LBB0_1 23; CHECK-NEXT: ## %bb.3: ## %bb1 24; CHECK-NEXT: ## in Loop: Header=BB0_2 Depth=1 25; CHECK-NEXT: cmpb $42, %cl 26; CHECK-NEXT: je LBB0_1 27; CHECK-NEXT: ## %bb.4: ## %bb3 28; CHECK-NEXT: movb $4, 2(%eax) 29; CHECK-NEXT: retl 30entry: 31 br label %bb1 32 33bb: ; preds = %bb1, %bb1 34 %indvar.next = add i32 %P.0.rec, 1 ; <i32> [#uses=1] 35 br label %bb1 36 37bb1: ; preds = %bb, %entry 38 %P.0.rec = phi i32 [ 0, %entry ], [ %indvar.next, %bb ] ; <i32> [#uses=3] 39 %P.0 = getelementptr i8, i8* %Q, i32 %P.0.rec ; <i8*> [#uses=2] 40 %0 = load i8, i8* %P.0, align 1 ; <i8> [#uses=1] 41 switch i8 %0, label %bb3 [ 42 i8 12, label %bb 43 i8 42, label %bb 44 ] 45 46bb3: ; preds = %bb1 47 %P.0.sum = add i32 %P.0.rec, 2 ; <i32> [#uses=1] 48 %1 = getelementptr i8, i8* %Q, i32 %P.0.sum ; <i8*> [#uses=1] 49 store i8 4, i8* %1, align 1 50 ret i8* %P.0 51} 52