llvm-6502/test/Transforms/LICM/PR24013.ll
David Majnemer a1b821fac9 [LICM] Don't try to sink values out of loops without any exits
There is no suitable basic block to sink instructions in loops without
exits.  The only way an instruction in a loop without exits can be used
is as an incoming value to a PHI.  In such cases, the incoming block for
the corresponding value is unreachable.

This fixes PR24013.

Differential Revision: http://reviews.llvm.org/D10903

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241987 91177308-0d34-0410-b5e6-96231b3b80d8
2015-07-12 03:53:05 +00:00

20 lines
545 B
LLVM

; RUN: opt -licm -S < %s | FileCheck %s
define void @f(i1 zeroext %p1) {
; CHECK-LABEL: @f(
entry:
br label %lbl
lbl.loopexit: ; No predecessors!
br label %lbl
lbl: ; preds = %lbl.loopexit, %entry
%phi = phi i32 [ %conv, %lbl.loopexit ], [ undef, %entry ]
; CHECK: phi i32 [ undef, {{.*}} ], [ undef
br label %if.then.5
if.then.5: ; preds = %if.then.5, %lbl
%conv = zext i1 undef to i32
br label %if.then.5
}