1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
llvm-mirror/test/Transforms/LoopDeletion/use-in-unreachable.ll
Serguei Katkov 444df39ddc [LoopDeletion] Handle users in unreachable block
This is a fix for PR35884.

When we want to delete dead loop we must clean uses in unreachable blocks
otherwise we'll get an assert during deletion of instructions from the loop.

Reviewers: anna, davide
Reviewed By: anna
Subscribers: llvm-commits, lebedev.ri
Differential Revision: https://reviews.llvm.org/D41943

llvm-svn: 322357
2018-01-12 07:24:43 +00:00

25 lines
577 B
LLVM

; RUN: opt < %s -loop-deletion -S | FileCheck %s
; Checking that possible users of instruction from the loop in
; unreachable blocks are handled.
define i64 @foo() {
entry:
br label %invloop
; CHECK-LABEL-NOT: invloop
invloop:
%indvar1 = phi i64 [ 3, %entry ], [ %indvar2, %invloop_iter ]
%check = icmp ult i64 %indvar1, 400
br i1 %check, label %invloop_iter, label %loopexit
invloop_iter:
%indvar2 = add i64 %indvar1, 1
%baddef = add i64 0, 0
br label %invloop
loopexit:
ret i64 0
deadcode:
; CHECK-LABEL: deadcode
; CHECK: ret i64 undef
ret i64 %baddef
}