1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/Examples/IRTransforms/SimplifyCFG/tut-simplify-cfg1.ll
Arthur Eubanks c4f40e948e [test][NewPM] Pin various tests to the legacy PM
tut-simplify-cfg hasn't been ported to the new PM.
llvm-lto2's -enable-new-pm defaults to the CMake flag, so the legacy PM extension test needs to be pinned.

Reviewed By: MaskRay, ychen

Differential Revision: https://reviews.llvm.org/D95898
2021-02-02 15:07:10 -08:00

91 lines
2.1 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -tut-simplifycfg -tut-simplifycfg-version=v1 -enable-new-pm=0 -S < %s | FileCheck %s
; RUN: opt -tut-simplifycfg -tut-simplifycfg-version=v2 -enable-new-pm=0 -S < %s | FileCheck %s
; RUN: opt -tut-simplifycfg -tut-simplifycfg-version=v3 -enable-new-pm=0 -S < %s | FileCheck %s
define i32 @simp1() {
; CHECK-LABEL: @simp1(
; CHECK-NEXT: entry:
; CHECK-NEXT: ret i32 10
;
entry:
br i1 true, label %if.then, label %if.else
if.then:
ret i32 10
if.else:
ret i32 12
}
define i32 @simp2() {
; CHECK-LABEL: @simp2(
; CHECK-NEXT: entry:
; CHECK-NEXT: ret i32 200
;
entry:
br i1 false, label %if.then, label %if.else
if.then:
ret i32 99
if.else:
ret i32 200
}
declare void @foo(i64)
define i64 @merge_into_predecessor(i64 %a, i64 %b) {
; CHECK-LABEL: @merge_into_predecessor(
; CHECK-NEXT: entry:
; CHECK-NEXT: [[R:%.*]] = add i64 [[A:%.*]], [[B:%.*]]
; CHECK-NEXT: call void @foo(i64 [[R]])
; CHECK-NEXT: call void @foo(i64 [[A]])
; CHECK-NEXT: ret i64 [[R]]
;
entry:
br label %bb.next
bb.next:
%r = add i64 %a, %b
call void @foo(i64 %r)
call void @foo(i64 %a)
br label %bb.next.next
bb.next.next:
ret i64 %r
}
define i64 @merge_into_predecessor_with_phi(i64 %a, i64 %b, i1 %c) {
; CHECK-LABEL: @merge_into_predecessor_with_phi(
; CHECK-NEXT: entry:
; CHECK-NEXT: call void @foo(i64 [[B:%.*]])
; CHECK-NEXT: [[R:%.*]] = add i64 [[A:%.*]], [[B]]
; CHECK-NEXT: call void @foo(i64 [[R]])
; CHECK-NEXT: call void @foo(i64 [[A]])
; CHECK-NEXT: br i1 [[C:%.*]], label [[BB_NEXT_NEXT:%.*]], label [[BB_EXIT:%.*]]
; CHECK: bb.next.next:
; CHECK-NEXT: br label [[BB_EXIT]]
; CHECK: bb.exit:
; CHECK-NEXT: [[RET:%.*]] = phi i64 [ [[R]], [[ENTRY:%.*]] ], [ 10, [[BB_NEXT_NEXT]] ]
; CHECK-NEXT: ret i64 [[RET]]
;
entry:
call void @foo(i64 %b)
br label %bb.next
bb.next:
%r = add i64 %a, %b
call void @foo(i64 %r)
call void @foo(i64 %a)
br i1 %c, label %bb.next.next, label %bb.exit
bb.next.next:
br label %bb.exit
bb.exit:
%ret = phi i64 [ %r, %bb.next], [ 10, %bb.next.next]
ret i64 %ret
}