Hal Finkel | f5867a7 | 2014-07-25 21:45:17 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -instcombine -S | FileCheck %s |
| 2 | target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 3 | target triple = "x86_64-unknown-linux-gnu" |
| 4 | |
| 5 | ; Function Attrs: nounwind |
| 6 | declare void @llvm.assume(i1) #1 |
| 7 | |
| 8 | ; Function Attrs: nounwind uwtable |
| 9 | define i32 @can1(i1 %a, i1 %b, i1 %c) { |
| 10 | entry: |
| 11 | %and1 = and i1 %a, %b |
| 12 | %and = and i1 %and1, %c |
| 13 | tail call void @llvm.assume(i1 %and) |
| 14 | |
| 15 | ; CHECK-LABEL: @can1 |
| 16 | ; CHECK: call void @llvm.assume(i1 %a) |
| 17 | ; CHECK: call void @llvm.assume(i1 %b) |
| 18 | ; CHECK: call void @llvm.assume(i1 %c) |
| 19 | ; CHECK: ret i32 |
| 20 | |
| 21 | ret i32 5 |
| 22 | } |
| 23 | |
| 24 | ; Function Attrs: nounwind uwtable |
| 25 | define i32 @can2(i1 %a, i1 %b, i1 %c) { |
| 26 | entry: |
| 27 | %v = or i1 %a, %b |
| 28 | %w = xor i1 %v, 1 |
| 29 | tail call void @llvm.assume(i1 %w) |
| 30 | |
| 31 | ; CHECK-LABEL: @can2 |
| 32 | ; CHECK: %[[V1:[^ ]+]] = xor i1 %a, true |
| 33 | ; CHECK: call void @llvm.assume(i1 %[[V1]]) |
| 34 | ; CHECK: %[[V2:[^ ]+]] = xor i1 %b, true |
| 35 | ; CHECK: call void @llvm.assume(i1 %[[V2]]) |
| 36 | ; CHECK: ret i32 |
| 37 | |
| 38 | ret i32 5 |
| 39 | } |
| 40 | |
| 41 | attributes #0 = { nounwind uwtable } |
| 42 | attributes #1 = { nounwind } |
| 43 | |