brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.0 KiB · f22c0f5 Raw
28 lines · plain
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-inlined3; main much.4; In contrast, with the full set of module inliner-related passes, at the end of5; inlining (incl. function cleanups ran after inlining), main will be reduced to6; a 'ret 10'7;8; RUN: opt -passes=inline -S < %s | FileCheck %s --check-prefix=INLINE --check-prefix=CHECK9; RUN: opt -passes=inliner-wrapper -S < %s | FileCheck %s --check-prefix=INLINE --check-prefix=CHECK10; RUN: opt -passes=scc-oz-module-inliner -S < %s | FileCheck %s --check-prefix=MODULE --check-prefix=CHECK11 12define void @modify_value(ptr %v) {13    %f = getelementptr { i32, float }, ptr %v, i64 0, i32 014    store i32 10, ptr %f15    ret void16}17 18define i32 @main() {19    %my_val = alloca {i32, float}20    call void @modify_value(ptr %my_val)21    %f = getelementptr { i32, float }, ptr %my_val, i64 0, i32 022    %ret = load i32, ptr %f23    ret i32 %ret24}25 26; CHECK-LABEL: @main27; INLINE-NEXT: %my_val = alloca28; MODULE-NEXT: ret i32 10