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