1 ; RUN: llc -mtriple=thumbv7m-eabi %s -o - | FileCheck %s
3 ; Check an edge case of the outlining costs -
4 ; outlining occurs in this test and does not in `bti-outliner-cost-2.ll`
5 ; the only difference being the branch target enforcement is enabled in the
8 ; volatile int a, b, c, d, e;
11 ; int r = (a + b) / (c + d) * e;
16 ; int r = (a + b) / (c + d) * e;
20 @a = hidden global i32 0, align 4
21 @b = hidden global i32 0, align 4
22 @c = hidden global i32 0, align 4
23 @d = hidden global i32 0, align 4
24 @e = hidden global i32 0, align 4
26 define hidden i32 @x(i32 %p) local_unnamed_addr #0 {
28 %0 = load volatile i32, ptr @a, align 4
29 %1 = load volatile i32, ptr @b, align 4
30 %add = add nsw i32 %1, %0
31 %2 = load volatile i32, ptr @c, align 4
32 %3 = load volatile i32, ptr @d, align 4
33 %add1 = add nsw i32 %3, %2
34 %div = sdiv i32 %add, %add1
35 %4 = load volatile i32, ptr @e, align 4
36 %mul = mul nsw i32 %4, %div
37 %add2 = add nsw i32 %mul, 1
41 ; CHECK: bl OUTLINED_FUNCTION_0
43 define hidden i32 @y(i32 %p) local_unnamed_addr #0 {
45 %0 = load volatile i32, ptr @a, align 4
46 %1 = load volatile i32, ptr @b, align 4
47 %add = add nsw i32 %1, %0
48 %2 = load volatile i32, ptr @c, align 4
49 %3 = load volatile i32, ptr @d, align 4
50 %add1 = add nsw i32 %3, %2
51 %div = sdiv i32 %add, %add1
52 %4 = load volatile i32, ptr @e, align 4
53 %mul = mul nsw i32 %4, %div
54 %add2 = add nsw i32 %mul, 2
58 ; CHECK: bl OUTLINED_FUNCTION_0
60 ; CHECK-LABEL: OUTLINED_FUNCTION_0:
63 attributes #0 = { minsize nofree norecurse nounwind optsize }
65 !llvm.module.flags = !{!0}
67 !0 = !{i32 8, !"branch-target-enforcement", i32 0}