• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; modify_value will be inlined into main. With just the inliner pass, at most
2; some trivial DCE would happen, which in this case doesn't modify post-inlined
3; main much.
4; In contrast, with the full set of module inliner-related passes, at the end of
5; inlining (incl. function cleanups ran after inlining), main will be reduced to
6; a 'ret 10'
7;
8; RUN: opt -passes=inline -S < %s | FileCheck %s --check-prefix=INLINE --check-prefix=CHECK
9; RUN: opt -passes=inliner-wrapper -S < %s | FileCheck %s --check-prefix=INLINE --check-prefix=CHECK
10; RUN: opt -passes=scc-oz-module-inliner -S < %s | FileCheck %s --check-prefix=MODULE --check-prefix=CHECK
11
12define void @modify_value({i32, float}* %v) {
13    %f = getelementptr { i32, float }, { i32, float }* %v, i64 0, i32 0
14    store i32 10, i32* %f
15    ret void
16}
17
18define i32 @main() {
19    %my_val = alloca {i32, float}
20    call void @modify_value({i32, float}* %my_val)
21    %f = getelementptr { i32, float }, { i32, float }* %my_val, i64 0, i32 0
22    %ret = load i32, i32* %f
23    ret i32 %ret
24}
25
26; CHECK-LABEL: @main
27; INLINE-NEXT: %my_val = alloca
28; MODULE-NEXT: ret i32 10