OSDN Git Service

[Loop Simplify] Resolve an issue where metadata is not applied to a loop latch.
authorSidharth Baveja <sidharth.baveja@ibm.com>
Fri, 17 Jul 2020 14:01:03 +0000 (14:01 +0000)
committerAnh Tuyen Tran <anhtuyen@ca.ibm.com>
Fri, 17 Jul 2020 14:02:14 +0000 (14:02 +0000)
commit11e879d4f111d21a669b2cde1444b85768b8a241
treef2c735fd1b743ff843900984f268dec76b9d9344
parent9275e14379961a4304de559f16fdbac275fb6301
[Loop Simplify] Resolve an issue where metadata is not applied to a loop latch.

Summary:
This patch resolves an issue where the metadata of a loop is not added to the
new loop latch, and not removed from the old loop latch. This issue occurs in
the SplitBlockPredecessors function, which  adds a new block in a loop, and
in the case that the block passed into this function is the header of the loop,
the loop can be modified such that the latch of the loop is replaced.
This patch applies to the Loop Simplify pass since it ensures that each loop
has exit blocks which only have predecessors that are inside of the loop. In
the case that this is not true, the pass will create a new exit block for the
loop. This guarantees that the loop preheader/header will dominate the exit blocks.

Author: sidbav (Sidharth Baveja)

Reviewers: asbirlea (Alina Sbirlea), chandlerc (Chandler Carruth), Whitney (Whitney Tsang), bmahjour (Bardia Mahjour)

Reviewed By:  asbirlea (Alina Sbirlea)

Subscribers: hiraditya (Aditya Kumar), llvm-commits

Tag: LLVM

Differential Revision: https://reviews.llvm.org/D83869
llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
llvm/test/Transforms/LoopSimplify/update_latch_md.ll [new file with mode: 0644]