1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
llvm-mirror/test/Transforms/SimplifyCFG/UncondBranchToHeader.ll
Roman Lebedev 785059d651 [SimplifyCFG] TryToSimplifyUncondBranchFromEmptyBlock() already knows how to preserve DomTree
... so just ensure that we pass DomTreeUpdater it into it.

Fixes DomTree preservation for a large number of tests,
all of which are marked as such so that they do not regress.
2020-12-17 01:03:49 +03:00

19 lines
467 B
LLVM

; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
; Check that we can get rid of empty block leading to header
; if it does not introduce new edge.
define i32 @test(i32 %c) {
entry:
br label %header
header:
%i = phi i32 [0, %entry], [%i.1, %backedge]
%i.1 = add i32 %i, 1
%cmp = icmp slt i32 %i.1, %c
br i1 %cmp, label %backedge, label %exit
; CHECK-NOT: backedge:
backedge:
br label %header
exit:
ret i32 %i
}