[all-commits] [llvm/llvm-project] ac28ef: [SimplifyCFG][TranformUtils]Do not simplify away a...
Mingming Liu via All-commits
all-commits at lists.llvm.org
Wed Sep 28 11:13:12 PDT 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ac28efa6c100cde81304f01b589d44b40b93ffeb
https://github.com/llvm/llvm-project/commit/ac28efa6c100cde81304f01b589d44b40b93ffeb
Author: Mingming Liu <mingmingl at google.com>
Date: 2022-09-28 (Wed, 28 Sep 2022)
Changed paths:
M llvm/lib/Transforms/Utils/Local.cpp
M llvm/test/Transforms/SimplifyCFG/preserve-llvm-loop-metadata.ll
Log Message:
-----------
[SimplifyCFG][TranformUtils]Do not simplify away a trivial basic block 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
More information about the All-commits
mailing list