]> granicus.if.org Git - llvm/commit
[LoopUnroll] Handle certain PHIs in full unrolling properly
authorBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Mon, 26 Aug 2019 09:29:53 +0000 (09:29 +0000)
committerBjorn Pettersson <bjorn.a.pettersson@ericsson.com>
Mon, 26 Aug 2019 09:29:53 +0000 (09:29 +0000)
commitc295640e42141a8f7ed50d3092b769f2026389da
tree4a74d78c5348b1d74e3bd2e6ce663082134b73d0
parent1d098622eca0db46490e2ccd05ae2bf087fb7656
[LoopUnroll] Handle certain PHIs in full unrolling properly

Summary:
When reconstructing the CFG of the loop after unrolling,
LoopUnroll could in some cases remove the phi operands of
loop-carried values instead of preserving them, resulting
in undef phi values after loop unrolling.

When doing this reconstruction, avoid removing incoming
phi values for phis in the successor blocks if the successor
is the block we are jumping to anyway.

Patch-by: ebevhan
Reviewers: fhahn, efriedma

Reviewed By: fhahn

Subscribers: bjope, lebedev.ri, zzheng, dmgreen, llvm-commits

Tags: #llvm

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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369886 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/LoopUnroll.cpp
test/Transforms/LoopUnroll/unroll-header-exiting-with-phis.ll [new file with mode: 0644]