Home | History | Annotate | Download | only in InstCombine
      1 ; do not replace a 'select' with 'or' in 'select - cmp - br' sequence
      2 ; RUN: opt -instcombine -S < %s | FileCheck %s
      3 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
      4 target triple = "x86_64-unknown-linux-gnu"
      5 
      6 declare void @f(i32)
      7 
      8 define void @test(i32 %len) {
      9 entry:
     10   %cmp = icmp ult i32 %len, 8
     11   %cond = select i1 %cmp, i32 %len, i32 8
     12   %cmp11 = icmp ult i32 0, %cond
     13   br i1 %cmp11, label %for.body, label %for.end
     14 
     15 for.body:                                         ; preds = %entry, %for.body
     16   %i.02 = phi i32 [ %inc, %for.body ], [ 0, %entry ]
     17   tail call void @f(i32 %cond)
     18   %inc = add i32 %i.02, 1
     19   %cmp1 = icmp ult i32 %inc, %cond
     20   br i1 %cmp1, label %for.body, label %for.end
     21 
     22 for.end:                                          ; preds = %for.body, %entry
     23   ret void
     24 ; CHECK: select
     25 }
     26