James Molloy | 7c7255e | 2016-09-08 12:58:04 +0000 | [diff] [blame] | 1 | ; RUN: llc %s -o - -O1 -debug-only=consthoist 2>&1 | FileCheck %s |
| 2 | ; REQUIRES: asserts |
| 3 | |
| 4 | target datalayout = "e-m:o-p:32:32-f64:32:64-v64:32:64-v128:32:128-a:0:32-n32-S32" |
| 5 | target triple = "thumbv6m-apple-ios8.0.0" |
| 6 | |
| 7 | declare void @g(i32) |
| 8 | |
| 9 | ; CHECK: Collect constant i32 -3 from call void @g(i32 -3) with cost 2 |
| 10 | define void @f(i1 %cond) { |
| 11 | entry: |
| 12 | call void @g(i32 -3) |
| 13 | br i1 %cond, label %true, label %ret |
| 14 | |
| 15 | true: |
| 16 | call void @g(i32 -3) |
| 17 | br label %ret |
| 18 | |
| 19 | ret: |
| 20 | ret void |
| 21 | } |
James Molloy | 753c18f | 2016-09-08 12:58:12 +0000 | [diff] [blame^] | 22 | |
| 23 | ; CHECK: Function: h |
| 24 | ; CHECK-NOT: Collect constant i32 -193 from |
| 25 | define void @h(i1 %cond, i32 %p, i32 %q) { |
| 26 | entry: |
| 27 | %a = and i32 %p, 4294967103 |
| 28 | call void @g(i32 %a) |
| 29 | br i1 %cond, label %true, label %ret |
| 30 | |
| 31 | true: |
| 32 | %b = and i32 %q, 4294967103 |
| 33 | call void @g(i32 %b) |
| 34 | br label %ret |
| 35 | |
| 36 | ret: |
| 37 | ret void |
| 38 | } |
| 39 | |