1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2 ; RUN: opt -S -passes=verify,iroutliner -ir-outlining-no-cost < %s | FileCheck %s
4 @global1 = global i32 1, align 4
5 @global2 = global i32 2, align 4
7 ; This test looks at the globals in the regions, and if it they are the
8 ; same it outlines the region without elevating the globals to arguments.
10 define void @outline_globals1() {
11 ; CHECK-LABEL: @outline_globals1(
13 ; CHECK-NEXT: call void @outlined_ir_func_0()
14 ; CHECK-NEXT: ret void
17 %0 = load i32, ptr @global1
18 %1 = load i32, ptr @global2
23 define void @outline_globals2() {
24 ; CHECK-LABEL: @outline_globals2(
26 ; CHECK-NEXT: call void @outlined_ir_func_0()
27 ; CHECK-NEXT: ret void
30 %0 = load i32, ptr @global1
31 %1 = load i32, ptr @global2
36 ; CHECK: define internal void @outlined_ir_func_0()
37 ; CHECK: entry_to_outline:
38 ; CHECK-NEXT: [[TMP1:%.*]] = load i32, ptr @global1, align 4
39 ; CHECK-NEXT: [[TMP2:%.*]] = load i32, ptr @global2, align 4
40 ; CHECK-NEXT: [[ADD:%.*]] = add i32 [[TMP1]], [[TMP2]]