1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py 2; RUN: opt < %s -instcombine -S 2>&1 | FileCheck %s 3target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64" 4 5; We are really checking that this doesn't loop forever. We would never 6; actually get to the checks here if it did. 7 8define void @timeout(i16* nocapture readonly %cinfo) { 9; CHECK-LABEL: @timeout( 10; CHECK-NEXT: entry: 11; CHECK-NEXT: br label [[FOR_BODY:%.*]] 12; CHECK: for.body: 13; CHECK-NEXT: [[ARRAYIDX15:%.*]] = getelementptr inbounds i16, i16* [[CINFO:%.*]], i32 2 14; CHECK-NEXT: [[L:%.*]] = load i16, i16* [[ARRAYIDX15]], align 2 15; CHECK-NEXT: [[CMP17:%.*]] = icmp eq i16 [[L]], 0 16; CHECK-NEXT: [[EXTRACT_T1:%.*]] = trunc i16 [[L]] to i8 17; CHECK-NEXT: br i1 [[CMP17]], label [[IF_THEN:%.*]], label [[IF_END:%.*]] 18; CHECK: if.then: 19; CHECK-NEXT: [[DOTPRE:%.*]] = load i16, i16* [[ARRAYIDX15]], align 2 20; CHECK-NEXT: [[EXTRACT_T:%.*]] = trunc i16 [[DOTPRE]] to i8 21; CHECK-NEXT: br label [[IF_END]] 22; CHECK: if.end: 23; CHECK-NEXT: [[P_OFF0:%.*]] = phi i8 [ [[EXTRACT_T]], [[IF_THEN]] ], [ [[EXTRACT_T1]], [[FOR_BODY]] ] 24; CHECK-NEXT: [[SUB:%.*]] = add i8 [[P_OFF0]], -1 25; CHECK-NEXT: store i8 [[SUB]], i8* undef, align 1 26; CHECK-NEXT: br label [[FOR_BODY]] 27; 28entry: 29 br label %for.body 30 31for.body: 32 %arrayidx15 = getelementptr inbounds i16, i16* %cinfo, i32 2 33 %l = load i16, i16* %arrayidx15, align 2 34 %cmp17 = icmp eq i16 %l, 0 35 br i1 %cmp17, label %if.then, label %if.end 36 37if.then: 38 %.pre = load i16, i16* %arrayidx15, align 2 39 br label %if.end 40 41if.end: 42 %p = phi i16 [ %.pre, %if.then ], [ %l, %for.body ] 43 %conv19 = trunc i16 %p to i8 44 %sub = add i8 %conv19, -1 45 store i8 %sub, i8* undef, align 1 46 br label %for.body 47} 48