59 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py2; RUN: opt -S -passes=verify,iroutliner -ir-outlining-no-cost < %s | FileCheck %s3 4; This test looks at the constants in the regions, and if it they are the5; same it outlines them as constants rather than elevating them to arguments.6 7define void @outline_constants1() {8; CHECK-LABEL: @outline_constants1(9; CHECK-NEXT: entry:10; CHECK-NEXT: [[A:%.*]] = alloca i32, align 411; CHECK-NEXT: [[B:%.*]] = alloca i32, align 412; CHECK-NEXT: [[C:%.*]] = alloca i32, align 413; CHECK-NEXT: call void @[[FUNCTION_0:.*]](ptr [[A]], ptr [[B]], ptr [[C]])14; CHECK-NEXT: ret void15;16entry:17 %a = alloca i32, align 418 %b = alloca i32, align 419 %c = alloca i32, align 420 store i32 2, ptr %a, align 421 store i32 3, ptr %b, align 422 store i32 4, ptr %c, align 423 %al = load i32, ptr %a24 %bl = load i32, ptr %b25 %cl = load i32, ptr %c26 ret void27}28 29define void @outline_constants2() {30; CHECK-LABEL: @outline_constants2(31; CHECK-NEXT: entry:32; CHECK-NEXT: [[A:%.*]] = alloca i32, align 433; CHECK-NEXT: [[B:%.*]] = alloca i32, align 434; CHECK-NEXT: [[C:%.*]] = alloca i32, align 435; CHECK-NEXT: call void @[[FUNCTION_0]](ptr [[A]], ptr [[B]], ptr [[C]])36; CHECK-NEXT: ret void37;38entry:39 %a = alloca i32, align 440 %b = alloca i32, align 441 %c = alloca i32, align 442 store i32 2, ptr %a, align 443 store i32 3, ptr %b, align 444 store i32 4, ptr %c, align 445 %al = load i32, ptr %a46 %bl = load i32, ptr %b47 %cl = load i32, ptr %c48 ret void49}50 51; CHECK: define internal void @[[FUNCTION_0]](ptr [[ARG0:%.*]], ptr [[ARG1:%.*]], ptr [[ARG2:%.*]])52; CHECK: entry_to_outline:53; CHECK-NEXT: store i32 2, ptr [[ARG0]], align 454; CHECK-NEXT: store i32 3, ptr [[ARG1]], align 455; CHECK-NEXT: store i32 4, ptr [[ARG2]], align 456; CHECK-NEXT: [[AL:%.*]] = load i32, ptr [[ARG0]], align 457; CHECK-NEXT: [[BL:%.*]] = load i32, ptr [[ARG1]], align 458; CHECK-NEXT: [[CL:%.*]] = load i32, ptr [[ARG2]], align 459