-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SimplifyCFG][TranformUtils]Do not simplify away a trivial basic bloc…
…k if both this block and at least one of its predecessors are loop latches. - Before this patch, loop metadata (if exists) will override the metadata of each predecessor; if the predecessor block already has loop metadata, the orignal loop metadata won't be preserved and could cause missed loop transformations (see 'test2' in llvm/test/Transforms/SimplifyCFG/preserve-llvm-loop-metadata.ll). To illustrate how inner-loop metadata might be dropped before this patch: CFG Before entry | v ---> while.cond -------------> while.end | | | v | while.body | | | v | for.body <---- (md1) | | |______| | v | while.cond.exit (md2) | | |_______| CFG After entry | v ---> while.cond.rewrite -------------> while.end | | | v | while.body | | | v | for.body <---- (md2) |_______| |______| Basically, when 'while.cond.exit' is folded into 'while.cond', 'md2' overrides 'md1' and 'md1' is dropped from the CFG. Differential Revision: https://reviews.llvm.org/D134152
- Loading branch information
1 parent
4d06861
commit ac28efa
Showing
2 changed files
with
81 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters