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 3 4; This test looks at the constants in the regions, and if it they are the 5; differents it elevates the constants to arguments. 6 7define void @outline_constants1() { 8; CHECK-LABEL: @outline_constants1( 9; CHECK-NEXT: entry: 10; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4 11; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4 12; CHECK-NEXT: [[C:%.*]] = alloca i32, align 4 13; CHECK-NEXT: call void @outlined_ir_func_0(i32 3, ptr [[A]], i32 4, ptr [[B]], i32 5, ptr [[C]]) 14; CHECK-NEXT: ret void 15; 16entry: 17 %a = alloca i32, align 4 18 %b = alloca i32, align 4 19 %c = alloca i32, align 4 20 store i32 3, ptr %a, align 4 21 store i32 4, ptr %b, align 4 22 store i32 5, ptr %c, align 4 23 %al = load i32, ptr %a 24 %bl = load i32, ptr %b 25 %cl = load i32, ptr %c 26 ret void 27} 28 29define void @outline_constants2() { 30; CHECK-LABEL: @outline_constants2( 31; CHECK-NEXT: entry: 32; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4 33; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4 34; CHECK-NEXT: [[C:%.*]] = alloca i32, align 4 35; CHECK-NEXT: call void @outlined_ir_func_0(i32 2, ptr [[A]], i32 3, ptr [[B]], i32 4, ptr [[C]]) 36; CHECK-NEXT: ret void 37; 38entry: 39 %a = alloca i32, align 4 40 %b = alloca i32, align 4 41 %c = alloca i32, align 4 42 store i32 2, ptr %a, align 4 43 store i32 3, ptr %b, align 4 44 store i32 4, ptr %c, align 4 45 %al = load i32, ptr %a 46 %bl = load i32, ptr %b 47 %cl = load i32, ptr %c 48 ret void 49} 50 51; CHECK: define internal void @outlined_ir_func_0(i32 [[ARG0:%.*]], ptr [[ARG1:%.*]], i32 [[ARG2:%.*]], ptr [[ARG3:%.*]], i32 [[ARG4:%.*]], ptr [[ARG5:%.*]]) #0 { 52; CHECK: entry_to_outline: 53; CHECK-NEXT: store i32 [[ARG0]], ptr [[ARG1]], align 4 54; CHECK-NEXT: store i32 [[ARG2]], ptr [[ARG3]], align 4 55; CHECK-NEXT: store i32 [[ARG4]], ptr [[ARG5]], align 4 56; CHECK-NEXT: [[AL:%.*]] = load i32, ptr [[ARG1]], align 4 57; CHECK-NEXT: [[BL:%.*]] = load i32, ptr [[ARG3]], align 4 58; CHECK-NEXT: [[CL:%.*]] = load i32, ptr [[ARG5]], align 4 59