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