1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/test/Transforms/SimplifyCFG/PR16069.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

34 lines
1010 B
LLVM

; NOTE: Assertions have been autogenerated by update_test_checks.py
; RUN: opt < %s -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
@b = extern_weak global i32
define i32 @foo(i1 %y) {
; CHECK-LABEL: @foo(
; CHECK: [[COND_I:%.*]] = phi i32 [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb2 ], [ 0, %0 ]
; CHECK-NEXT: ret i32 [[COND_I]]
;
br i1 %y, label %bb1, label %bb2
bb1:
br label %bb3
bb2:
br label %bb3
bb3:
%cond.i = phi i32 [ 0, %bb1 ], [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb2 ]
ret i32 %cond.i
}
define i32 @foo2(i1 %x) {
; CHECK-LABEL: @foo2(
; CHECK: [[COND:%.*]] = phi i32 [ 0, %bb1 ], [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb0 ]
; CHECK-NEXT: ret i32 [[COND]]
;
bb0:
br i1 %x, label %bb1, label %bb2
bb1:
br label %bb2
bb2:
%cond = phi i32 [ 0, %bb1 ], [ srem (i32 1, i32 zext (i1 icmp eq (i32* @b, i32* null) to i32)), %bb0 ]
ret i32 %cond
}