diff options
author | Mingming Liu <mingmingl@google.com> | 2022-09-18 17:33:09 -0700 |
---|---|---|
committer | Mingming Liu <mingmingl@google.com> | 2022-09-28 10:48:14 -0700 |
commit | ac28efa6c100cde81304f01b589d44b40b93ffeb (patch) | |
tree | 47d7eb7f85ea9b72dd12bf29104fc680b3e17488 /llvm/lib/CodeGen/MachineBasicBlock.cpp | |
parent | 4d06861950978b223f6ebdacee071e8203d0911b (diff) | |
download | llvm-ac28efa6c100cde81304f01b589d44b40b93ffeb.zip llvm-ac28efa6c100cde81304f01b589d44b40b93ffeb.tar.gz llvm-ac28efa6c100cde81304f01b589d44b40b93ffeb.tar.bz2 |
[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
Diffstat (limited to 'llvm/lib/CodeGen/MachineBasicBlock.cpp')
0 files changed, 0 insertions, 0 deletions