• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -S -Oz %s | FileCheck %s
2
3@a = global i32 4
4
5define i32 @inner() {
6  %a1 = load volatile i32, i32* @a
7
8  ; Here are enough instructions to prevent inlining, but because they are used
9  ; only by the @llvm.assume intrinsic, they're free (and, thus, inlining will
10  ; still happen).
11  %a2 = mul i32 %a1, %a1
12  %a3 = sub i32 %a1, 5
13  %a4 = udiv i32 %a3, -13
14  %a5 = mul i32 %a4, %a4
15  %a6 = add i32 %a5, %a5
16  %ca = icmp sgt i32 %a6, -7
17  tail call void @llvm.assume(i1 %ca)
18
19  ret i32 %a1
20}
21
22; @inner() should be inlined for -Oz.
23; CHECK-NOT: call i1 @inner
24define i32 @outer() optsize {
25   %r = call i32 @inner()
26   ret i32 %r
27}
28
29declare void @llvm.assume(i1) nounwind
30
31