Files
clang-p2996/llvm/test/Transforms/IROutliner/outlining-basic-branches.ll
Andrew Litteken 81d3ac0cf2 [IROutliner] Adding outlining for single entry/single exit multiblock regions
Using the similarity found from the IRSimilarity Identifier, we take regions with structural similarity, and deduplicate them into a separate function. The Code Extractor is able to provide most of this functionality.

For simplicity, we start by only outlining regions with a single entry and single exit branch, this reduces the complexity in handling phi nodes outside the region, and handling many sets of outputs for each of the different exit blocks.

Reviewer: paquette

Differential Revision: https://reviews.llvm.org/D106990
2021-09-07 08:51:54 -07:00

53 lines
1.4 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --include-generated-funcs
; RUN: opt -S -verify -iroutliner -ir-outlining-no-cost < %s | FileCheck %s
; This checks that we are able to outline exactly the same structure without
; any other items to outline.
define void @outline_outputs1() #0 {
entry:
br label %next
next:
br label %next2
next2:
br label %next
next3:
%a = alloca i32, align 4
br label %next4
next4:
br label %next3
next5:
br label %next6
next6:
%b = alloca i32, align 4
ret void
}
; CHECK-LABEL: @outline_outputs1(
; CHECK-NEXT: entry:
; CHECK-NEXT: br label [[NEXT:%.*]]
; CHECK: next:
; CHECK-NEXT: call void @outlined_ir_func_0()
; CHECK-NEXT: br label [[NEXT]]
; CHECK: next3:
; CHECK-NEXT: [[A:%.*]] = alloca i32, align 4
; CHECK-NEXT: call void @outlined_ir_func_0()
; CHECK-NEXT: br label [[NEXT3:%.*]]
; CHECK: next5:
; CHECK-NEXT: br label [[NEXT6:%.*]]
; CHECK: next6:
; CHECK-NEXT: [[B:%.*]] = alloca i32, align 4
; CHECK-NEXT: ret void
;
;
; CHECK: define internal void @outlined_ir_func_0(
; CHECK: newFuncRoot:
; CHECK-NEXT: br label [[NEXT_TO_OUTLINE:%.*]]
; CHECK: next_to_outline:
; CHECK-NEXT: br label [[NEXT2:%.*]]
; CHECK: next2:
; CHECK-NEXT: br label [[NEXT_EXITSTUB:%.*]]
; CHECK: next.exitStub:
; CHECK-NEXT: ret void
;