Preserve loop metadata when splitting exit blocks
authorCraig Topper <craig.topper@intel.com>
Tue, 13 Nov 2018 23:06:49 +0000 (23:06 +0000)
committerCraig Topper <craig.topper@intel.com>
Tue, 13 Nov 2018 23:06:49 +0000 (23:06 +0000)
commit3c87c2a3c50bdc35a65af101318e6282e51d0d9c
treef3123a93730b9772b9a5dfefe2117d04d5056408
parentcad864d49e90b95de39d62f71fb6d1b7172b7498
Preserve loop metadata when splitting exit blocks

LoopUtils.cpp contains a utility that splits an loop exit block, so that the new block contains only edges coming from the loop. In the case of nested loops, the exit path for the inner loop might also be the back-edge of the outer loop. The new block which is inserted on this path, is now a latch for the outer loop, and it needs to hold the loop metadata for the outer loop. (The test case gives a more concrete view of the situation.)

Patch by Chang Lin (clin1)

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

llvm-svn: 346810
llvm/lib/Transforms/Utils/LoopUtils.cpp
llvm/test/Transforms/LoopSimplify/preserve-llvm-loop-metadata2.ll [new file with mode: 0644]