1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00
llvm-mirror/test/Reduce/remove-bbs-ret-nonvoid.ll
Florian Hahn 102583c8b4 [llvm-reduce] Create returns with undef values for non-void functions.
Currently replaceBranchTerminator/removeUninterestingBBsFromSwitch
always creates `ret void` instructions if no successor is in the chunk.

This results in invalid IR for functions with non-void return types,
which makes those reductions unfeasible. Instead, create `ret ty undef`
for functions with non-void return types.

Reviewed By: lebedev.ri

Differential Revision: https://reviews.llvm.org/D86849
2020-08-31 16:33:46 +01:00

30 lines
722 B
LLVM

; Test that llvm-reduce inserts valid return instructions for functions with
; on-void return types.
;
; RUN: llvm-reduce --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t
; RUN: cat %t | FileCheck %s
; CHECK-INTERESTINGNESS: interesting:
; CHECK-INTERESTINGNESS: interesting2:
define i32 @main(i1 %c) {
; CHECK-LABEL: define i32 @main() {
; CHECK-LABEL: interesting:
; CHECK-NEXT: br label %interesting2
; CHECK-LABEL: interesting2:
; CHECK-NEXT: ret i32 undef
interesting:
br label %interesting2
interesting2:
br i1 true, label %uninteresting1, label %uninteresting
uninteresting:
br label %uninteresting1
uninteresting1:
ret i32 10
}