1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-26 04:32:44 +01:00
llvm-mirror/test/Transforms/SimplifyCFG/pr35774.ll
Roman Lebedev 495950222a [NFCI][SimplifyCFG] Mark all the SimplifyCFG tests that already don't invalidate DomTree as such
First step after e1133179587dd895962a2fe4d6eb0cb1e63b5ee2,
in these tests, DomTree is valid afterwards, so mark them as such,
so that they don't regress.

In further steps, SimplifyCFG transforms shall taught to preserve DomTree,
in as small steps as possible.
2020-12-17 01:03:49 +03:00

36 lines
1.1 KiB
LLVM

; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S %s | FileCheck %s
%foo = type { i32 (%foo)*, i32 }
declare i32 @putchar(i32)
define i32 @intercept(%foo %f) {
; CHECK-LABEL: @intercept(
; CHECK-NEXT: [[FN:%.*]] = extractvalue [[FOO:%.*]] %f, 0
; CHECK-NEXT: [[X:%.*]] = extractvalue [[FOO]] %f, 1
; CHECK-NEXT: [[X0:%.*]] = icmp eq i32 [[X]], 0
; CHECK-NEXT: br i1 [[X0]], label [[ZERO:%.*]], label [[NONZERO:%.*]]
; CHECK: Zero:
; CHECK-NEXT: [[R0:%.*]] = musttail call i32 [[FN]](%foo [[F:%.*]])
; CHECK-NEXT: ret i32 [[R0]]
; CHECK: Nonzero:
; CHECK-NEXT: [[R1:%.*]] = tail call i32 [[FN]](%foo [[F]])
; CHECK-NEXT: [[TMP1:%.*]] = tail call i32 @putchar(i32 [[R1]])
; CHECK-NEXT: ret i32 [[R1]]
;
%fn = extractvalue %foo %f, 0
%x = extractvalue %foo %f, 1
%x0 = icmp eq i32 %x, 0
br i1 %x0, label %Zero, label %Nonzero
Zero:
%r0 = musttail call i32 %fn(%foo %f)
ret i32 %r0
Nonzero:
%r1 = tail call i32 %fn(%foo %f)
%1 = tail call i32 @putchar(i32 %r1)
ret i32 %r1
}