
The instruction simplification will try to simplify the affected phis. In some cases, this might extend the liveness of values. For example: BB0: | \ | BB1 | / BB2:phi (BB0, v), (BB1, undef) The phi in BB2 will be simplified to v as v dominates BB2, but this is increasing the number of active values in BB1. By setting CanUseUndef to false, we will not simplify the phi in this way, this would help register pressure. This is mandatory for the later change to help reducing VGPR pressure for AMDGPU. Reviewed by: foad, sameerds Differential Revision: https://reviews.llvm.org/D132449
42 lines
1.2 KiB
LLVM
42 lines
1.2 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
|
|
; RUN: opt -S -o - -structurizecfg < %s | FileCheck %s
|
|
|
|
define void @test1() {
|
|
; CHECK-LABEL: @test1(
|
|
; CHECK-NEXT: entry:
|
|
; CHECK-NEXT: br label [[LOOP:%.*]]
|
|
; CHECK: Flow:
|
|
; CHECK-NEXT: br label [[FLOW1:%.*]]
|
|
; CHECK: loop:
|
|
; CHECK-NEXT: [[CTR:%.*]] = phi i32 [ 0, [[ENTRY:%.*]] ], [ [[TMP0:%.*]], [[FLOW1]] ]
|
|
; CHECK-NEXT: [[CTR_NEXT:%.*]] = add i32 [[CTR]], 1
|
|
; CHECK-NEXT: br i1 undef, label [[LOOP_A:%.*]], label [[FLOW1]]
|
|
; CHECK: loop.a:
|
|
; CHECK-NEXT: br i1 undef, label [[LOOP_B:%.*]], label [[FLOW:%.*]]
|
|
; CHECK: loop.b:
|
|
; CHECK-NEXT: br label [[FLOW]]
|
|
; CHECK: Flow1:
|
|
; CHECK-NEXT: [[TMP0]] = phi i32 [ [[CTR_NEXT]], [[FLOW]] ], [ undef, [[LOOP]] ]
|
|
; CHECK-NEXT: [[TMP1:%.*]] = phi i1 [ false, [[FLOW]] ], [ true, [[LOOP]] ]
|
|
; CHECK-NEXT: br i1 [[TMP1]], label [[EXIT:%.*]], label [[LOOP]]
|
|
; CHECK: exit:
|
|
; CHECK-NEXT: ret void
|
|
;
|
|
entry:
|
|
br label %loop
|
|
|
|
loop:
|
|
%ctr = phi i32 [ 0, %entry ], [ %ctr.next, %loop.a ], [ %ctr.next, %loop.b ]
|
|
%ctr.next = add i32 %ctr, 1
|
|
br i1 undef, label %exit, label %loop.a
|
|
|
|
loop.a:
|
|
br i1 undef, label %loop, label %loop.b
|
|
|
|
loop.b:
|
|
br label %loop
|
|
|
|
exit:
|
|
ret void
|
|
}
|