[LoadCombine] Avoid analysing dead basic blocks
authorBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Wed, 12 Apr 2017 08:07:55 +0000 (08:07 +0000)
committerBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Wed, 12 Apr 2017 08:07:55 +0000 (08:07 +0000)
commit4af0593eccb036b9272552335495ecb626299522
tree4bdf65d4be7c9f87e07195d78474acdac2b1289f
parentf8486e31ca228075d4174a10a4c850efc015e77b
[LoadCombine] Avoid analysing dead basic blocks

Summary:
Dead basic blocks may be forming a loop, for which SSA form is
fulfilled, but with a circular def-use chain. LoadCombine could
enter an infinite loop when analysing such dead code. This patch
solves the problem by simply avoiding to analyse all basic blocks
that aren't forward reachable, from function entry, in LoadCombine.

Fixes https://bugs.llvm.org/show_bug.cgi?id=27065

Reviewers: mehdi_amini, chandlerc, grosser, Bigcheese, davide

Reviewed By: davide

Subscribers: dberlin, zzheng, bjope, grandinj, Ka-Ka, materi, jholewinski, llvm-commits, mzolotukhin

Differential Revision: https://reviews.llvm.org/D31032

llvm-svn: 300034
llvm/lib/Transforms/Scalar/LoadCombine.cpp
llvm/test/Transforms/LoadCombine/deadcode.ll [new file with mode: 0644]